Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
2  
Cough... organized layout? In Windows?.. Can you give some examples please? –  alex Jul 6 '11 at 8: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 6 '11 at 8:41
3  
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 6 '11 at 9:05
1  
@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 6 '11 at 9:37
3  
Could you name some examples of folders you have in mind? –  Peter Eisentraut Jul 6 '11 at 10:50

1 Answer 1

up vote 8 down vote accepted

(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.

share|improve this answer
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 6 '11 at 9: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 6 '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 6 '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 6 '11 at 10:12
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 6 '11 at 10:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.