GNU/Linux / File system locations – WhyNotWiki

Ethan Caldwell Blog

< GNU/Linux

> whatis hier
hier (7)             - Description of the file system hierarchy

> man hier
       A typical Linux system has, among others, the following directories:

       /      This is the root directory.  This is where the whole tree starts.

       /bin   This directory contains executable programs which are needed in single user mode and to bring the system up or repair it.

       /boot  Contains  static  files  for  the  boot  loader.   This  directory  only holds the files which are needed during the boot process.  The map
              installer and configuration files should go to /sbin and /etc.

       /dev   Special or device files, which refer to physical devices.  See mknod(1).

       /etc   Contains configuration files which are local to the machine.  Some larger software packages, like X11, can have  their  own  subdirectories
              below /etc.  Site-wide configuration files may be placed here or in /usr/etc.  Nevertheless, programs should always look for these files in
              /etc and you may have links for these files to /usr/etc.
...

       /home  On machines with home directories for users, these are usually beneath this directory, directly or not.  The structure  of  this  directory
              depends on local administration decisions.

       /lib   This directory should hold those shared libraries that are necessary to boot the system and to run the commands in the root filesystem.

       /media This directory contains mount points for removable media such as CD and DVD disks or USB sticks.

       /mnt   This  directory  is a mount point for a temporarily mounted filesystem.  In some distributions, /mnt contains subdirectories intended to be
              used as mount points for several temporary filesystems.

       /opt   This directory should contain add-on packages that contain static files.

       /proc  This is a mount point for the proc filesystem, which provides information about running processes and the kernel.  This pseudo-file  system
              is described in more detail in proc(5).

       /root  This directory is usually the home directory for the root user (optional).

       /sbin  Like /bin, this directory holds commands needed to boot the system, but which are usually not executed by normal users.
...
       /usr   This  directory  is  usually mounted from a separate partition.  It should hold only sharable, read-only data, so that it can be mounted by
              various machines running Linux.
...
       /usr/bin
              This  is  the  primary  directory  for executable programs.  Most programs executed by normal users which are not needed for booting or for
              repairing the system and which are not installed locally should be placed in this directory.
...
       /usr/doc
              Replaced by /usr/share/doc.

       /usr/etc
              Site-wide configuration files to be shared between several machines may be stored in this directory.  However, commands should always  ref‐
              erence those files using the /etc directory.  Links from files in /etc should point to the appropriate files in /usr/etc.
...
       /usr/include
              Include files for the C compiler.
...
       /usr/lib
              Object libraries, including dynamic libraries, plus some executables which usually are not invoked directly.  More complicated programs may
              have whole subdirectories there.
...
       /usr/local
              This is where programs which are local to the site typically go.

       /usr/local/bin
              Binaries for programs local to the site.

       /usr/local/doc
              Local documentation.

       /usr/local/etc
              Configuration files associated with locally installed programs.
...
       /var   This directory contains files which may change in size, such as spool and log files.

       /var/adm
              This directory is superseded by /var/log and should be a symbolic link to /var/log.

       /var/backups
              Reserved for historical reasons.

       /var/cache
              Data cached for programs.

...
       /var/lib
              Variable state information for programs.

       /var/local
              Variable data for /usr/local.

       /var/lock
              Lock  files are placed in this directory.  The naming convention for device lock files is LCK.. where  is the device’s name
              in the filesystem.  The format used is that of HDU UUCP lock files, that is, lock files contain a PID as a 10-byte  ASCII  decimal  number,
              followed by a newline character.

       /var/log
              Miscellaneous log files.

...
       /var/run
              Run-time  variable  files,  like  files holding process identifiers (PIDs) and logged user information (utmp).  Files in this directory are
              usually cleared when the system boots.

       /var/spool
              Spooled (or queued) files for various programs.



The Filesystem Hierarchy Standard