Inhaltsverzeichnis
Anyone analyzing or repairing a Linux system needs to know where configurations, logs, and data are stored. The Filesystem Hierarchy Standard (FHS 3.0, released in 2015) defines this structure for Linux. Distributions largely adhere to it, with minor deviations in details.
The table lists the common directories, followed by special cases where old descriptions are no longer accurate.
Directories at a Glance
System, hardware and runtime
| Directory | Description | Details and Files |
| /boot | Files for the boot process | Kernel, bootloader, and their configurations |
| /dev | Device files | Virtual files for devices such as /dev/null, /dev/sda |
| /etc | System-wide configuration files | fstab, hosts, hostname, resolv.conf, timezone (Debian and Ubuntu) |
| /proc | Virtual filesystem | Information about processes and system state |
| /sys | Virtual filesystem | Information about hardware and kernel |
| /run | Runtime data since boot | PID files and sockets, resides in RAM (tmpfs) |
| /run/lock | Lock files | Prevents concurrent access to resources |
| /lost+found | Filesystem recovery directory | This is where the filesystem check stores file fragments, with a separate directory for each filesystem |
Programs and libraries
| Directory | Description | Details and Files |
| /bin | Essential user command binaries | bash, chmod, cp, ls, mv, ping, touch (often symlinked to /usr/bin) |
| /sbin | System binaries | fdisk, reboot, route, mkfs (often symlinked to /usr/sbin) |
| /lib | Shared libraries and kernel modules | For binaries in /bin and /sbin (often symlinked to /usr/lib) |
| /lib32 | 32-bit libraries on 64-bit systems | For 32-bit applications |
| /lib64 | 64-bit libraries | For 64-bit applications |
| /usr | User programs and data | /usr/bin (programs), /usr/lib (libraries) |
| /usr/local | Locally installed software | Self-compiled or manually installed programs |
| /opt | Optional additional software | Programs and data, often from third parties |
| /snap | Snap packages | Mounted Snap applications (Ubuntu) |
User data, services, and mount points
| Directory | Description | Details and Files |
| /home | User directories | Personal data and configuration for each user |
| /root | Home directory of the root user | Located outside of /home so that root can operate even if /home is not mounted |
| /var | Variable data | Logs, caches, spool directories, email queues |
| /tmp | Temporary files | For short-lived data |
| /srv | Data for services | Files served by web or FTP servers |
| /media | Mount points for removable media | USB drives, CDs that are automatically mounted |
| /mnt | Temporary mount points | For file systems that you mount manually |
Additional important paths
| Path | Description |
| /etc/skel | Template for new user directories |
| /var/log | System and application logs, first point of call for troubleshooting |
| /var/spool | Spool files for tasks such as printing and email |
| /proc/cpuinfo and /proc/meminfo | Information about CPU and RAM |
| /dev/shm | Shared memory for applications |
Edge cases: When old descriptions are no longer accurate
Merged /usr. On distributions with a merged /usr, such as Fedora, /bin, /sbin, /lib, and /lib64 are symlinks to their counterparts in /usr. The programs are then physically located only in /usr, and both paths access the same file. The separation dates back to a time when /usr was on a separate disk and is now obsolete. Check on your system with ls -ld /bin to see if it is a symlink.
/selinux. This directory is obsolete. It was previously the mount point for the selinuxfs filesystem and did not contain any security policies. Since Debian Wheezy, selinuxfs is mounted under /sys/fs/selinux. SELinux policies and configuration are located under /etc/selinux.
/run/shm. Debian introduced /run to consolidate volatile data such as /var/run, /var/lock, and /dev/shm. This resulted in /run/shm. Modern systems use /dev/shm as shared memory, while /run/shm sometimes appears only as a compatibility symlink.
/etc/timezone. This file exists on Debian and Ubuntu. On other distributions, the timezone is stored in /etc/localtime.
More PhinIT articles:
- ext4 | Fourth Extended Filesystem | Filesystem commonly found under / on many servers
- ZFS | Zettabyte File System | Filesystem that uses pools instead of partitions
- Tutorial | NTP - Adjusting Time/Date | Time services, hwclock, and /etc/timezone in detail
Sources
| Source | Topic | URL |
| Filesystem Hierarchy Standard 3.0 | Structure and Directory Purposes | https://debian.org/doc/packaging-manuals/fhs/fhs-3.0.html |
| systemd: Plädoyer für die /usr-Zusammenführung | /bin, /sbin, /lib, /lib64 as Symlinks to /usr | https://systemd.io/THE_CASE_FOR_THE_USR_MERGE/ |
| Fedora Wiki: UsrMove | Merged /usr in Fedora, /run as tmpfs | https://fedoraproject.org/wiki/Features/UsrMove |
| Debian Wiki: Run Directory | Introduction of /run, migration from /dev/shm | https://wiki.debian.org/ReleaseGoals/RunDirectory |
| Debian-devel mailing list (2013) | Removal of /selinux, selinuxfs under /sys/fs/selinux | https://lists.debian.org/debian-devel/2013/05/msg00253.html |