Search notes:

Linux: Filesystem Hierarchy Standard

The (Linux) file system hierarchy standard is sometimes abbreviated with FHS.
The Filesystem Hierarchy Standard is a reference describing the conventions used for the layout of a UNIX system.
/ This is the root directory under which the whole «FHS tree» is located.
/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 holds only the files which are needed during the boot process.
The map installer and configuration files should go to /sbin and /etc.
The operating system kernel (initrd for example) must be located in either / or /boot.
/dev Special or device files, which refer to physical devices.
/run and its subdirectories expose userspace sockets and files.
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, for example /etc/X11.
/etc/opt Host-specific configuration files for add-on applications installed in /opt.
/etc/skel When a new user account is created, files from this directory are usually copied into the user's home directory.
/home »Home« directories for users. The entire path for a user whose name is username is located under /home/username and can be referred to in a shell with the tilde ~.
/lib This directory should hold those shared libraries that are necessary to boot the system and to run the commands in the root filesystem.
/lib<qual> These directories are variants of /lib on system which support more than one binary format requiring separate libraries.
/lib/modules Loadable kernel modules.
/lost+found This directory contains items lost in the filesystem. These items are usually chunks of files mangled as a consequence of a faulty disk or a system crash.
/media contains mount points for removable media such as CD and DVD disks or USB sticks.
On systems where more than one device exists for mounting a certain type of media, mount directories can be created by appending a digit to the name of those available above starting with '0', but the unqualified name must also exist.
/mnt holds mount points for temporarily mounted filesystems.
In some distributions, /mnt contains subdirectories intended to be used as mount points for several temporary filesystems.
/opt contains add-on packages that contain static files.
/proc The mount point for the proc filesystem, which provides information about running processes and the kernel which exposes kernel settings, processes and other kernel information to userspace. (Compare with /sys)
/root is usually the home directory for the root user.
/sbin Like /bin, this directory holds commands needed to boot the system, but which are usually not executed by normal users.
/srv contains site-specific data that is served by this system.
Sub directories might be /srv/http or /srv/ftp.
/sys mount point for the sysfs filesystem which exposes kernel devices, drivers and other kernel information to userspace (Compare /proc)
/tmp contains temporary files which may be deleted without notice, usually at system boot up, but also by a regular job. Compare with /var/tmp.
/usr should only contain sharable, read-only data, so that it can be mounted by various Linux installations.
Thus, it is usually mounted from a separate partition.
/usr/bin is the primary directory for executable programs which are not necessary for booting or repairing a system and run by »normal« users.
/usr/games Binaries for games and educational programs.
/usr/include Include files for the C compiler.
/usr/include/X11 Include files for the C compiler and the X-Window system.
/usr/include/asm Include files which declare some assembler functions.
/usr/include/linux contains information which may change from system release to system release.
/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. (Apparently empty under arch linux).
/usr/sbin contains program binaries for system administration which are not essential for the boot process, for mounting /usr, or for system repair.
/usr/share contains subdirectories with specific application data, that can be shared among different architectures of the same OS.
/usr/share/dict contains the word lists used by spell checkers (for example /usr/share/dict/words is a list of english words).
/usr/share/zoneinfo contains files for timezone information (optional).
/var contains files which may change in size, such as spool and log files.
/var/cache: Data cached for programs.
/var/crash System crash dumps.
/var/lib Variable state information for programs.
/var/lock contains lock files.
/var/log is for log files.
/var/run contains run-time variable files, like files holding process identifiers (PIDs) and logged user information (utmp).
/var/tmp contains temporary files. Compare /tmp.

Misc

Most Linux distributions follow the FHS. Two examples of non compliant distributions are:

See also

man hier
/snap

Links

Fileystem Hierarchy Standard

Index