The Filesystem Hierarchy Standard (FHS)
The Filesystem Hierarchy Standard (FHS) defines the directory structure and directory contents in Linux and Unix-like operating systems. It is maintained by the Linux Foundation and provides a predictable layout that software and users can depend on.
Understanding the FHS is fundamental for any Linux engineer. Whether you're troubleshooting a production server at 3 AM or architecting a new deployment, knowing exactly where files live—and why—separates competent administrators from exceptional ones.
Root Directory Structure
Every Linux system starts at / — the root directory. From here, the filesystem branches into a well-defined hierarchy:
/
├── bin/ # Essential user command binaries
├── boot/ # Boot loader files, kernel images
├── dev/ # Device files (block, character devices)
├── etc/ # System-wide configuration files
├── home/ # User home directories
├── lib/ # Essential shared libraries
├── media/ # Mount points for removable media
├── mnt/ # Temporary mount points
├── opt/ # Optional/third-party software
├── proc/ # Virtual filesystem for process info
├── root/ # Root user's home directory
├── run/ # Runtime variable data
├── sbin/ # Essential system binaries
├── srv/ # Data for services (HTTP, FTP)
├── sys/ # Virtual filesystem for kernel objects
├── tmp/ # Temporary files (cleared on reboot)
├── usr/ # Secondary hierarchy (user programs)
└── var/ # Variable data (logs, mail, spool)
Critical Directories in Detail
/etc — The Configuration Nexus
This is where all system-wide configuration lives. Key files include:
/etc/passwd # User account information
/etc/shadow # Encrypted password data
/etc/fstab # Filesystem mount table
/etc/hosts # Static hostname resolution
/etc/resolv.conf # DNS resolver configuration
/etc/ssh/ # SSH server/client configuration
/etc/nginx/ # Nginx web server configuration
/etc/systemd/ # SystemD unit file overrides
/var — Variable Runtime Data
Logs, caches, mail spools, and other data that changes during operation:
/var/log/ # System and application logs
/var/cache/ # Application cache data
/var/lib/ # State information for applications
/var/spool/ # Queued data (mail, print jobs)
/var/tmp/ # Temporary files preserved across reboot
/proc — The Virtual Window into the Kernel
This pseudo-filesystem exposes kernel and process information as files. Every running process gets a numbered directory:
cat /proc/cpuinfo # CPU information
cat /proc/meminfo # Memory statistics
cat /proc/loadavg # System load averages
cat /proc/1/status # Status of PID 1 (init/systemd)
cat /proc/version # Kernel version string
The /usr Hierarchy
The /usr directory contains the majority of user-space programs and data. It mirrors the root filesystem structure:
/usr/bin/ # Non-essential user commands
/usr/sbin/ # Non-essential system commands
/usr/lib/ # Libraries for /usr/bin and /usr/sbin
/usr/local/ # Locally compiled software
/usr/share/ # Architecture-independent data
/usr/include/ # C/C++ header files
Practical Tips for Engineers
- Always check
/var/logfirst when troubleshooting — the answer is usually in the logs - Never store application data in
/tmp— it's wiped on reboot on most distributions - Use
/optfor third-party software that doesn't follow the standard package layout - Mount
/varon a separate partition in production to prevent log floods from filling the root filesystem - The
/proc/sysinterface lets you tune kernel parameters at runtime withsysctl
Mastering the filesystem hierarchy isn't just academic knowledge—it's the foundation that every other Linux skill builds upon.