-1

The Linux filesystem hierarchy is full of unused folders that only exist for historical reasons.

Do any distros install with only the directories that are actually used?

Caleb
  • 70,105
Maxpm
  • 772
  • 3
    Cough... organized layout? In Windows?.. Can you give some examples please? – alex Jul 06 '11 at 08:35
  • 1
    @alex Start in your OS partition and you see "Windows," which is obviously where important system stuff goes; "Program Files," where you can rely on finding a given program's binaries and config files; "Users," which is where personal stuff goes, etc. It's all quite intuitive, and there are single, centralized places for everything. (One exception is that some games store save files in Documents, while others put them in Program Files.) – Maxpm Jul 06 '11 at 08:41
  • 4
    But enter either Windows or Program Files and you'll be totally lost as to which things go where, not to mention the Documents and Settings zoo. – alex Jul 06 '11 at 09:05
  • Turn on visibility for "hidden files and folders" then navigate around C:\Windows and tell us it's organized! – Caleb Jul 06 '11 at 09:11
  • 2
    @Caleb Perhaps not, but the layout as a whole is far better than that of Linux. The point I'm trying to make here is that while there are multiple "valid" areas for a file in Linux, it's much more well-defined on Windows. – Maxpm Jul 06 '11 at 09:37
  • @Maxpm: I think if you read up on the meanings your distro uses for each directory you'll find the opposite is true. When you find a file in Linux, it's path tells you a lot about it. When you find a file in Windows you don't learn much except that you found the file. @alex wasn't kidding when he said the docs and settings folder was a zoo. Have you turned on hidden files and looked around at all the duplication in there? E.g. Windows has to specify full paths to ALL programs because they could be anywhere. Linux has a set small list in a $PATH variable because they are carefully placed. – Caleb Jul 06 '11 at 09:57
  • @Maxpm: more examples please. What are these "valid" areas for which files? What are "invalid" ones? And what's the "much more well-defined" counter-part on Windows? – alex Jul 06 '11 at 10:02
  • @alex Really, this is growing tiresome. I'm not here to prove that Windows has a superior layout to Linux, but rather it gives me a greater feeling of succinctness and clarity than Linux does. (Even Linux's short, all-lowercase names contribute to this.) For me, this feeling is extremely important, because I know I'm in charge of my system and it's working for me, rather than hiding some sort of obfuscated black magic under the hood. – Maxpm Jul 06 '11 at 10:08
  • 1
    You started that :-p Now you see everyone have his own definition of "Clean". ;-) – alex Jul 06 '11 at 10:12
  • @alex Indeed. Adding that statement to the original question was a mistake, and I'll make an edit to rectify it. – Maxpm Jul 06 '11 at 10:13
  • @Maxpm: Longer names give you a feeling of succinctness that short ones do not? Funny, I feel just the oposite. – Caleb Jul 06 '11 at 10:22
  • @Caleb Yep. I'm weird like that. I also tend to fully qualify type names even when I don't have to, e.g. namespace Namespace { void Function(Namespace::Foo Bar); } – Maxpm Jul 06 '11 at 10:26
  • 3
    Could you name some examples of folders you have in mind? – Peter Eisentraut Jul 06 '11 at 10:50
  • 2
    You make the claim that the filesystem is "full of unused folders", yet you have yet to mention a single one. Please edit your question to cite some examples if you want that aspect answered. – Caleb Jul 07 '11 at 06:55
  • 1
    See this question for a useful discussion of what some of the folders mean to somebody coming from a Windows background. – Caleb Jul 20 '11 at 10:23

1 Answers1

9

(Rewritten after comments showed this question and my answer were not moving anywhere productive. It's got a new tone and covers the ground a bit differently).

To answer the new question:

Each distribution does what they feel is best for their users. This usually consists of A) some level of customization to fit their particular philosophy and B) some level of standardization for comparability with other distros.

The most important standardizing factor is the FHS / Filesystem Hierarchy Standard which tries to keep a clear and consise definition for all the major directories found on UNIX systems today. The standard is evolving to accommodate the needs of modern distros but moves slowly so as not to break old ones. Most distros don't wander too far from FHS. Read it. It will help you make sense of all Unices.

While not every directory might be used in a default install, most of them are. The hierarchy is not "full of unused" directories, and even the few that start out empty are there because they will potentially be used. For example, since binaries from distro packages are all installed in /usr/bin and /usr/local/bin is for custom additions of your own, the later folder will start out empty on any clean installation. However, it still exists for a purpose.

To answer to original question:

The original question began with a comparison about the "organized" Windows directory layout and the "confusing" Unix layout. I do not think that is a fair comparison, here is why.

Any comparisons between systems needs to take into account the scope of the things being compared. You can compare and apple to an orange and produce* a useful list of differences. Some people will prefer one over the other. What you cannot easily do is compare an apple to an oil refinery.

That's intentionally a dramatic statement, but I hope it helps you to understand the scenario at hand. The Unix file system does more than the Windows file system does. It is therefore more complex. If you want to compare them, you should take into account all the systems in Windows play the same roles covered by just the file system in Unix. For example the things the Windows Registry does are mostly rolled into the Unix file system. In Unix, devices like your hard drives and mice are also file nodes and can be manipulated as such. Even meta data about running processes and kernel level options like networking parameters can be read and written to through the file system. On Windows these require special APIs and complex programs. In Unix it's as simple as reading or writing a text file. This explains things like the /proc, /sys, /dev, and /run directory structures which don't appear to have counterparts in Windows.

Additionally, in spite of the extra function, it probably isn't as "dirty" as you might first assume. There are historical reasons for some decisions, but they continue to exist because they continue to be used. I am not aware of folders that are routinely empty.

The user-facing GUIs in Linux operation almost entirely in realm of the $HOME directory. Everything is in /home/username or your distro's equivalent. Inside that space, there is a trend towards verbose names with capitals such as "Downloads" and "Pictures" rather than "incoming" and "pics". Anyone simply USING a Linux computer through a modern GUI is unlikely to need to know about anything other than these familiarly named folders in their home directory.

Anything outside the home directory is the realm of system administrators. Only when you want to modify or extend a Linux system do you need to learn about the rest of the directory structure. If you plan on writing software, or tinkering with existing bits, it is worthwhile to learn the current conventions as detailed in the FHS specifications which are generally adhered to by most distros.

Also of note when coming from a Windows background is that, in general, distributions rather than individual software packages make the decisions about where things go. They are generally very similar, but each distro will have an overall unifying philosophy of where things should be kept. In Windows software, the software authors place their stuff wherever they want and distribute it with an installer that places it there. Usually everything ends up in some tree of their own design under a couple folders with their program's name. In the Linux world, software is usually distributed in packages maintained by the makers of the distro. Upstream software is split up, wrapped and generally made to conform to the distro's preferences. This usually results in a much more organized overall system. You don't need to re-learn anything with each new package you install, the important thing is that you already know the ropes of your distro and everything will be consistently found in the same places.

When looking for the executables for package A, B and C, where A is from part of the Windows core but B and C are from different vendors. In Windows it might be:

c:\Windows\System32\programA.exe
c:\Program Files\Vendor A - Program A\packageA\program\A.exe
c:\Program Files\programB\bin\program.exe

...but it could be several other variants depending on the vendor's habits. Let's say in Linux you installed package B through the package repositories and C by downloading a source package and manually installing it. The binaries will predictably end up in:

/usr/A
/usr/bin/B
/usr/local/bin/C

If you still feel the system needs "fixing" it might be worth considering the comments on this question. It is possible to "re-organize" the current layout, but any attempt to do so will quickly run afoul of what many consider very finely tuned machinery.

* Pun intended.

Caleb
  • 70,105
  • 1
    I do program for fun, and the filesystem does feel like a Big Ball of Mud. I have looked through guides to help explain the layout, but there are still duplicates like those in this question that leave me scratching my head. – Maxpm Jul 06 '11 at 09:42
  • 1
    @Maxpm: None of those 5 (plus the one he forgot) listed are duplicates, they serve very specific purposes that @geekosour explained fairly well. sbin denotes things an administrator would use, but not a user. local denotes things installed manually NOT through the distributions package manager, and usr is for things that you USE on a system while the straight bin folder is for core things the system needs to boot. Shall I list the 173 places these things show up in on a Windows system? – Caleb Jul 06 '11 at 10:01
  • 1
    @Maxpm: The question you mention is answered really clearly IMO. If you have further questions after reading that, you may try adding some comments to specific answers. – alex Jul 06 '11 at 10:04
  • 1
    @alex Yes, it is, but you can see where the confusion comes from. The fact that the question was asked in the first place does say something. – Maxpm Jul 06 '11 at 10:12
  • @Maxpm: The fact that the question was answered says something else. There wasn't even a lot of disagreement or "my distro does this" style diversity. Such a terse and understandable answer could not be written to cover the same ground in Windows. Windows apps each have their own file structure instead of being packed by a distro with a unifying phylosophy of where each kind of thing should go. – Caleb Jul 06 '11 at 10:18
  • @Caleb I'm not debating this anymore. See my comment on the original question. If you must, chalk this up as a victory for whatever. – Maxpm Jul 06 '11 at 10:23
  • @Maxpm: I would say your original question does not specify a clear idea of what you think could be improved. The most useful thing seems to be to point this question at the one you liked above that answers the specific question about bin folders and move on. If you edit your question with some other specific question ABOUT Linux maybe we can answer that too. – Caleb Jul 06 '11 at 10:26
  • 1
    @Caleb I asked whether or not any distros clipped the unused directories, and you answered "No" and gave a good explanation. I'm satisfied with that, and I see no need to focus the question on a specific case. – Maxpm Jul 06 '11 at 10:32
  • @Maxpm: Several people have asked but you haven't given any examples on Linux of what is a dirty or empty directory. There is probably an explanation if you want to ask specifically. In general, see my edited answer. – Caleb Jul 06 '11 at 10:52
  • 1
    @Caleb I know for a fact that, when reading the FHS, I came across at least one instance of "Foo is obsolete and should not be used. It may be a link to Bar." My Ctrl+F skills are failing me right now, though. – Maxpm Jul 06 '11 at 21:29
  • @Maxpm: Of course the spec has notes about obsolete folders so that developers are directed to update their code to use the correct paths. However your question says "full of empty folders" and so far you haven't named a single example of an empty folder on your system. – Caleb Jul 07 '11 at 06:53