The Filesystem Hierarchy Standard (FHS), maintained by the Linux Foundation, defines the directory tree used by Linux and most Unix-like operating systems β making it possible to write software, scripts, and tools that work consistently across distributions. Understanding this hierarchy is foundational to system administration, debugging, and security: when something goes wrong on a Linux system, knowing exactly where logs live, where binaries are found, and how virtual filesystems expose kernel state can mean the difference between a quick fix and hours of confusion. A key mental model: the Linux filesystem is a single tree rooted at /, and every device, network share, or virtual interface is mounted as a subtree within it β nothing is outside the tree.
What This Cheat Sheet Covers
This topic spans 15 focused tables and 141 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Root Filesystem Top-Level Directories
The root directory / is the anchor point for every path on a Linux system. Each immediate child of / has a carefully defined role under FHS 3.0, and understanding what belongs where prevents both misconfiguration and unnecessary confusion when navigating an unfamiliar machine.
| Directory | Example | Description |
|---|---|---|
/bin/ls, /bin/bash | β’ Essential user command binaries needed in single-user mode and before /usr is mountedβ’ on modern distros a symlink to /usr/bin via usrmerge | |
/etc/passwd, /etc/fstab | β’ Host-specific system configuration files β’ must be static text β no binaries β’ the central nerve centre for system behaviour | |
/var/log/syslog, /var/spool/mail | Variable data that changes during normal operation: logs, spools, caches, and runtime state. | |
/usr/bin/python3, /usr/lib/ | β’ Shareable, read-only user data β’ the second major section β’ contains the bulk of installed programs and libraries | |
/home/alice/.bashrc | β’ User home directories β’ each user's personal data, configuration dotfiles, and settings live here | |
mktemp /tmp/tmpXXXXXX | β’ Temporary files β’ deleted on reboot (often tmpfs) β’ writable by all users β’ sticky bit set so users cannot delete each other's files | |
/dev/sda, /dev/null | β’ Device files β character and block devices β’ managed at runtime by udev on devtmpfs | |
/proc/cpuinfo, /proc/1234/ | β’ Virtual filesystem (procfs) exposing kernel data structures and per-process information β’ nothing is stored on disk | |
/sys/class/net/eth0/ | β’ sysfs virtual filesystem exporting the kernel device model β’ organised by buses, classes, and devices β’ mounted on /sys. | |
/run/sshd.pid, /run/docker.sock | β’ Runtime variable data (tmpfs) β’ PID files, Unix sockets, and lock files valid only for the current boot β lost on reboot |