Can somebody help me with the linux directory mess?


Bosbeetle

Terminally lost
Joined
Sep 7, 2008
Messages
4,275
Age
42
Location
The Netherlands
Website
Visit site
So reading linux for dummies (yeah I know) I see some nice conventions that are part of the linux way of thinking. Such as there are the directories for specific purposes

like 

home

bin 

sbin

dev

(etc ;)

But can anybody give me a clear map of what's the deal nowadays, I recently installed debian on a laptop and it seems everything is everywhere stuff is in usr/share/bin  other stuff is in opt other stuff is in etc/, some mount to mnt others to media  does somebody have a clear discription of what should be where and why?
 
Last edited by a moderator:
Last edited by a moderator:
Look at 


echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
All of these paths are treated  as one. 

So if i enter the name of an executable the terminal scans all of this paths for this program. 

Different users/runlevels may have a different path setting there. The distro maintainer may set the guideline that tells what belongs into which folder, but why exactly a program uses a path is up to the package creator.
 
Last edited by a moderator:
Look at 


echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
All of these paths are treated  as one. 

So if i enter the name of an executable the terminal scans all of this paths for this program. 

Different users/runlevels may have a different path setting there. The distro maintainer may set the guideline that tells what belongs into which folder, but why exactly a program uses a path is up to the package creator.
Ah so in general these make no difference.
 
Look at 


echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
All of these paths are treated  as one. 

So if i enter the name of an executable the terminal scans all of this paths for this program. 

Different users/runlevels may have a different path setting there. The distro maintainer may set the guideline that tells what belongs into which folder, but why exactly a program uses a path is up to the package creator.
Ah so in general these make no difference.
Yes, once the system is booted up.  However, /sbin is guaranteed to be available at initial boot while /usr (and /bin which is commonly a link into /usr/bin) may be on a partition which hasn't been mounted yet.  And /usr/local should be basically empty on a freshly installed system; my /usr/local/bin only contains a couple of scripts I've written myself, and is guaranteed not to be trampled on by apt-get.

Also, as mentioned by Elw3, not all users will have all those directories in their path.

My link was missing an 'l' at the end I think: the correct link (hopefully) is:

http://www.debianadmin.com/linux-directory-structure-overview.html
 
It begins to make more sense to me, however I still think the usr/bin could have been just in /bin. But I guess that's because I only work on my own machine and don't need to maintain user groups etc.
 
There are actually good reasons for a lot of the decisions made about how the filesystem is laid out.

 

/bin has traditionally been for binaries/tools that are necessary to use the system when it is in single-user mode - i.e. no /usr mounted .. in the bad ol' days of Unix, /usr was only mounted after the system came up successfully and became a multi-user system.  So /usr/bin contains stuff that is mostly for the users whereas /bin is stuff that the administrator *must* have onboard in order to resuscitate a system that is in single-user mode.

Over time, the filesystem layout has become the subject of many different cultures - some use /opt for things, some use /usr/local/, and so on - each of these have their own reasoning and it requires a bit of historical understanding to glean why.
 
I thought /sbin was for admin/single user tools?  On any system I've used recently /bin seems to be a softlink to /usr/bin, presumably for compatibility with something or other.
 
I thought /sbin was for admin/single user tools?  On any system I've used recently /bin seems to be a softlink to /usr/bin, presumably for compatibility with something or other.
Noticed that with the latest Fedora:

bin -> usr/bin

lib -> usr/lib

lib64 -> usr/lib64

sbin -> usr/sbin
 
I thought /sbin was for admin/single user tools?  On any system I've used recently /bin seems to be a softlink to /usr/bin, presumably for compatibility with something or other.
Splitting / and /usr have an historic reason I'd though Trashy would explain. In the old ages prior LTO tapes even before hard-drive, Unix system booted of a bootable tape. Unfortunatly, the tape were too small to hold the whole OS, so the system requiered 2 tapes. The boot one ruled the single user mode. Once the firsts stages of boot were done the second tape were mounted on /usr and the multi-user mode was activated.
I havent seen a separated /usr mount point in ages, so "modern" distro symlinking / to /usr somehow make sense, albeit I would have made it the other way around... anyway
 
Splitting / and /usr have an historic reason I'd though Trashy would explain.
I'll have you know I never actually used a UNIX machine that booted off a tape drive, the DEC machine running VAX/VMS I was working on a few years ago had one, but didn't boot off it... Also it had an 8" floppy drive.
 
Last edited by a moderator:
I havent seen a separated /usr mount point in ages, so "modern" distro symlinking / to /usr somehow make sense, albeit I would have made it the other way around... anyway
I have /usr in a separate partition because of the layouts of the flash memory on this machine (/boot and /usr on the 4GB chip, everything else on the 64GB one).

This is on Arch though, so it doesn't even have a separate sbin folder; /sbin is a softlink to /usr/bin, just as /bin is.  I had to enable a specific kernel flag (I think) to mount /usr before running init.
 
Back
Top