r/AskLinuxUsers • u/Buckshot_Mouthwash • May 17 '16
Why must the Unix directory structure seem so messy?
As I am sure from the title, you can tell I am a Linux novice. I use it, but only on the rare occasion where I have to or when I get the urge to learn more about it (which happens all the time... but always ends in frustration). I blame my ignorance on most of the issues I have, but the file structure has always been relatively counter intuitive.
Lets start with what I like and understand. I like the separation of "like" items and permissions. I get the why and where, and am starting to gain familiarity as to where to expect things.
The issue I have is when this system breaks down, becomes cluttered, and files are strewn about or duplicated without rhyme or reason because of write perms. This is ultimately what gets me fed up. Every time I spin up a distro and start pulling in packages, it quickly turns into something only the package manager seems to be able to maintain, because I sure as hell have no idea which files are where or which ones are being used.
My most recent example:
I am working on an Asterisk PBX and installing Festival TTS. Any documentation I find refers to editing the festival.scm file and adding a few lines. "Sure" I say to myself, "no problem... but where?" some places mention that its either in /etc/ or /usr/share/festival/. First off... why "or"? Secondly... after running find -name festival.scm, I find out its in BOTH, plus others! (I understand at least one is an expample.)
./usr/share/festival/festival.scm
./usr/share/doc/festival/examples/festival.scm
./etc/festival.scm
./root/usr/share/festival/festival.scm
./root/etc/festival.scm
Now, it could be worse... there has been times where I do this and find that the same (or variations, or fragments) file is in nearly a dozen locations.
Sorry this turned into more of a rant than a clear question, but how do people maintain systems like this after they have pulled in hundreds of dependencies and packages and the directories become one big cluster-f***?
16
u/CSIRTisSmelly ^.*$ May 17 '16
Every UNIX admin and developer should read and understand this, in my opinion:
http://www.pathname.com/fhs/pub/fhs-2.3.html
The only problem is that once you understand the method to the madness, you will begin to see just how often people who should know better will break the rules. One of those, "can't unsee" sort of deals.
1
u/necrophcodr May 17 '16
The top 3 files are probably different. The first one is the default configuration, the second is for documentation purposes, an example (which may or may not be the same as the default configuration) and the third is the copy of the file that you should modify.
I have no idea why those same files are in the /root directory as well. I really have no problem with the structure.
If an application is supposed to read a configuration file that can be modified, it's supposed to read from /etc. /usr/share is for static content mostly, content that is not meant to be modified. I say mostly because of course certain applications and systems break these rules, but that's no fault of the system, but of the individual applications and libraries.
1
u/lykwydchykyn May 18 '16
This is part of the reason we have package management utilities. They're supposed to take stock of what each package puts on the system when it's installed, and remove those files when it's uninstalled. Of course, if you have people who do an end run around this and install software with
make installor by unzipping tarballs wherever they feel like it, there isn't much you can do to preserve sanity.Kind of goes for anything as a sysadmin. If you ignore standards and conventions and just do whatever is most convenient at the time, you're building up technical debt and making a mess for yourself (or the next guy). Doesn't matter whether it's Unix, Windows, racking hardware, designing an IP scheme, or routing cables.