linux fs

The linux file system slightly varies from Distro to Distro - but there are some general rules

It rather looks like this

  bin  boot  dev  etc  home  lib  mnt  proc  sbin  tmp  usr  var
                        |                                |
                    +---+---+                        +---+---+
                   abc lmn xyz                      bin lib sbin
                   notes  labs

Unify or Not ?

Putting the same type of files in the same named folders makes sense.

Purpose of each of the Root Level Directories

The FSH File System Hierarchy - is very much documented - please google "Filesystem Hierarchy Standard" - But be warned it is rather Dull.


Seems to be faily standard with most of its FSH


With the exception to /opt RHEL also follows the FSH


Not as good as the 2 other Distro's - possibly due to Darwin being from a much older Linux "tree".

General Linux FSH and its meaning

dir purpose
/bin stores essential binaries (programs) needed when booting the system or working in single user mode to maintain the system
/boot stores kernel images and boot configuration files
/dev stores device special files used to access hardware devices
/etc stores system configuration files
/home stores the home directories for the individual users
/lib stores library modules used by the commands
/mnt a mount point for other storage devices
/proc a pseudo filesystem for conveying data about processes
/sbin stores commands required to administer the system
/tmp used for temporary files
/usr used for programs, libraries, documentation, etc used by normal users
/var stored system data that varies or changes frequently such as system logs, mail and print spool files, etc

RHEL View on this

dir purpose
/usr/bin Directory for the executables that are accessed by all users (everybody have this directory in their $PATH). The main files of your Software will probably be here. You should never create a subdirectory under this folder.
/bin Like /usr/bin, but here you'll find only boot process vital executables, that are simple and small. Your Software (being high-level) probably doesn't have nothing to install here.
/usr/sbin Like /usr/bin, but contains only the executables that must be accessed by the administrator (root user). Regular users should never have this directory in their $PATH. If your Software is a daemon, This is the directory for some of executables.
/sbin Like /usr/sbin, but only for the boot process vital executables, and that will be accessed by sysadmin for some system maintaining. Commands like fsck (filesystem check), init (father of all processes), ifconfig (network configuration), mount, etc can be found here. It is the system's most vital directory.
/usr/lib Contains dynamic libraries and support static files for the executables at /usr/bin and /usr/sbin. You can create a subdirectory like /usr/lib/myproduct to contain your helper files, or dynamic libraries that will be accessed only by your Software, without user intervention. A subdirectory here can be used as a container for plugins and extensions.
/lib Like /usr/lib but contains dynamic libraries and support static files needed in the boot process. You'll never find an executable at /bin or /sbin that needs a library that is outside this directory. Kernel modules (device drivers) are under /lib.
/etc Contains configuration files. If your Software uses several files, put them under a subfolder like /etc/myproduct/
/var The name comes from "variable", because everything that is under this directory changes frequently, and the package system (RPM) doesn't keep control of. Usually /var is mounted over a separate high-performance partition. In /var/log logfiles grow up. For web content we use /var/www, and so on.
/home Contains the user's (real human beings) home directories. Your Software package should never install files here (in installation time). If your business logic requires a special UNIX user (not a human being) to be created, you should assign him a home directory under /var or other place outside /home. Please, never forget that.
/usr/share/doc, /usr/share/man The "share" word is used because what is under /usr/share is platform independent, and can be shared among several machines across a network filesystem. Therefore this is the place for manuals, documentations, examples etc.
/usr/local, /opt These are obsolete folders. When UNIX didn't have a package system (like RPM), sysadmins needed to separate an optional (or local) Software from the main OS. These were the directories used for that.

PLEASE Note: /opt under RHEL is not really encouraged