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.
/ 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 (only files which are needed during the boot process). The map installer and configuration files should go to /sbin and /etc. The operating system kernel (for example initrd) must be located in either / or /boot.
/dev Special or device files, usually referring to physical devices.
/run /run and its subdirectories expose userspace sockets and files. See mknod (1).
/etc Configuration files which are local to the machine (some site-wite configuration files may also be placed in/usr/etc). 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.
/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 ~ or ~rene.
/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 lost items in the filesystem. These items are usually chunks of files mangled as a consequence of a faulty disk or a system crash.
/media 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 add-on packages that contain static files.
/proc 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/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 Program binaries for system administration which are not essential for the boot process, for mounting /usr, or for system repair.
/usr/share Subdirectories with specific application data, that can be shared among different architectures of the same OS.
/usr/share/dict word lists used by spell checkers (for example /usr/share/dict/words is a list of english words).
/usr/share/zoneinfo Files for timezone information (optional).
/var 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 log files.
/var/run Run-time variable files, like files holding process identifiers (PIDs) and logged user information (utmp).
/var/tmp Temporary files. Compare /tmp.
/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 Information which may change from system release to system release.

Misc

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

Mount points

findmnt can be used to display the hierarchy of mounted filesystems, for example:
$ findmnt -oTARGET,SOURCE,FSTYPE
TARGET                                                  SOURCE      FSTYPE
/                                                       /dev/md2    ext4
├─/sys                                                  sysfs       sysfs
│ ├─/sys/kernel/security                                securityfs  securityfs
│ ├─/sys/fs/cgroup                                      cgroup2     cgroup2
│ ├─/sys/fs/pstore                                      pstore      pstore
│ ├─/sys/firmware/efi/efivars                           efivarfs    efivarfs
│ ├─/sys/fs/bpf                                         bpf         bpf
│ ├─/sys/kernel/debug                                   debugfs     debugfs
│ │ └─/sys/kernel/debug/tracing                         tracefs     tracefs
│ ├─/sys/kernel/tracing                                 tracefs     tracefs
│ ├─/sys/kernel/config                                  configfs    configfs
│ ├─/sys/fs/fuse/connections                            fusectl     fusectl
│ └─/sys/kernel/config                                  configfs    configfs
├─/proc                                                 proc        proc
│ └─/proc/sys/fs/binfmt_misc                            systemd-1   autofs
│   └─/proc/sys/fs/binfmt_misc                          binfmt_misc binfmt_misc
├─/dev                                                  udev        devtmpfs
│ ├─/dev/pts                                            devpts      devpts
│ ├─/dev/shm                                            tmpfs       tmpfs
│ ├─/dev/mqueue                                         mqueue      mqueue
│ └─/dev/hugepages                                      hugetlbfs   hugetlbfs
├─/run                                                  tmpfs       tmpfs
│ ├─/run/lock                                           tmpfs       tmpfs
│ ├─/run/credentials/systemd-sysctl.service             ramfs       ramfs
│ ├─/run/credentials/systemd-sysusers.service           ramfs       ramfs
│ ├─/run/credentials/systemd-tmpfiles-setup-dev.service ramfs       ramfs
│ ├─/run/credentials/systemd-tmpfiles-setup.service     ramfs       ramfs
│ └─/run/user/1000                                      tmpfs       tmpfs
└─/boot                                                 /dev/md0    ext4
  └─/boot/efi                                           /dev/sdd1   vfat

See also

man hier
/snap

Links

Fileystem Hierarchy Standard

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Linux/fh...', 1758201508, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Linux/fhs/index(140): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78