Linux File System Explained: /usr /home /bin /var and so on.
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Found a good site, pathname.com, explains the remarkably obscure Linux file naming system. Yes, there is a logic to it.

From /usr to /var to /dev/null, everything you ever wanted to know but were afraid to ask.

Learning what these names refer to will help you understand better what Linux uses for its core logic.
:: Quote ::
# 3 The Root Filesystem

* 3.4 /bin : Essential user command binaries (for use by all users)
* 3.5 /boot : Static files of the boot loader
* 3.6 /dev : Device files
* 3.7 /etc : Host-specific system configuration
* 3.8 /home : User home directories (optional)
* 3.9 /lib : Essential shared libraries and kernel modules
* 3.10 /lib<qual> : Alternate format essential shared libraries (optional)
* 3.11 /mnt : Mount point for a temporarily mounted filesystem
* 3.12 /opt : Add-on application software packages
* 3.13 /root : Home directory for the root user (optional)
* 3.14 /sbin : System binaries
* 3.15 /tmp : Temporary files

# 4 The /usr Hierarchy

* 4.4 /usr/X11R6 : X Window System, Version 11 Release 6 (optional)
* 4.5 /usr/bin : Most user commands
* 4.6 /usr/include : Directory for standard include files.
* 4.7 /usr/lib : Libraries for programming and packages
* 4.8 /usr/lib<qual> : Alternate format libraries (optional)
* 4.9 /usr/local : Local hierarchy
* 4.10 /usr/sbin : Non-essential standard system binaries
* 4.11 /usr/share : Architecture-independent data
* 4.12 /usr/src : Source code (optional)

# 5 The /var Hierarchy

* 5.4 /var/account : Process accounting logs (optional)
* 5.5 /var/cache : Application cache data
* 5.6 /var/crash : System crash dumps (optional)
* 5.7 /var/games : Variable game data (optional)
* 5.8 /var/lib : Variable state information
* 5.9 /var/lock : Lock files
* 5.10 /var/log : Log files and directories
* 5.11 /var/mail : User mailbox files (optional)
* 5.12 /var/opt : Variable data for /opt
* 5.13 /var/run : Run-time variable data
* 5.14 /var/spool : Application spool data
* 5.15 /var/tmp : Temporary files preserved between system reboots
* 5.16 /var/yp : Network Information Service (NIS) database files (optional)


Read the real stuff at pathname.
Back to top
minck
Status: Interested
Joined: 02 Nov 2004
Posts: 39
Location: Belgium
Reply Quote
very useful link. I've come across quite a few articles explaining the various parts of the filesystem, but none so thorough as this. I guess this is 'the' standard for the filesystem, no?

Good programming relies on well-thought out naming conventions so variables can easily be accessed in automated ways, like in loops - and the same goes for files when you're code is getting complicated. Even if you don't end up using big loops that need to access a wide variety of different variables and files, just having some order in your system of variable names and file names / directory names does so much to keep the mind fresh for coding, with minimal baggage of stuff you've got to remember.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
:: Quote ::
Good programming relies on well-thought out naming conventions so variables can easily be accessed in automated ways, like in loops - and the same goes for files when you're code is getting complicated.

Definitely, the less trivial junk you have to think about and forget, the more you can focus on the primary job, which is, or should be, the fun part.

With networks it's the same of course, consistent file/folder naming should always serve as a note to yourself, or anyone else, that is sufficiently clear to act as a comment, ideally anyway.

Now getting people to follow conventions, that's another story. It's the same issues in Linux though, from what I've read debian uses a very logical system, but other distros use slightly different versions.

But overall, it's good to get a grasp of the unix/linux file system hierarchy, I was happy to find that source, it's very good to have all this in one place.

By the way, an excellent overview book I'm reading is O'Reilly presses: Running Linux. Since this is linux, my version, 3rd edition, from 1999, is almost as useful today as when it was written, although 4th edition is now out.

Luckily I was reading it on the plane to a recent networking type job, the part I read helped me understand enough of what the Windows os's I was dealing with actually are doing that I could resolve a very tricky technical problem. Which confirms what I've thought, if you want to learn how computers work, learn linux, it's not hidden. Windows does much of the same stuff, only gui's and cute interfaces try to hide all that. But the terminology isn't standard.

For example, to unmount a drive in windows, you have several apparently different options, disabling it in device manager, stopping it if it's an external firewire type unit, but both disable and stop means the same thing: umount.

1 week with a windows network makes me utterly loathe the current direction proprietary OS and software development is moving.
Back to top
Display posts from previous:   

All times are GMT - 8 Hours