The Filesystem Hierarchy
Linux organises everything under a single root directory / following a standard layout.
Unlike Windows with its C: and D: drives, Linux has a single tree that starts at the root directory /. Every disk and device is attached somewhere inside this one tree.
Key directories
| Path | Holds |
|---|---|
/bin, /usr/bin | Programs and commands. |
/etc | System configuration files. |
/home | Personal folders, one per user. |
/var | Changing data — logs, mail, caches. |
/tmp | Temporary files (cleared on reboot). |
/root | The home directory of the root user. |
Example
# List the top level of the whole system
ls /
# bin boot dev etc home lib root tmp usr var
# Configuration lives in /etc
ls /etc/ssh
# Logs live in /var/log
ls /var/logWhen to use it
- A package maintainer places the app binary in '/usr/bin' and configuration in '/etc/myapp/' following the Filesystem Hierarchy Standard so users know where to look.
- A sysadmin checks '/var/log/auth.log' during a security incident because FHS guarantees authentication logs live under '/var/log'.
- A developer mounts a Docker volume at '/var/lib/myapp/data' because the FHS specifies '/var/lib' for persistent application state.
More examples
Explore top-level FHS directories
Lists the top-level FHS directories that form a predictable map of every Linux filesystem.
ls /
# bin boot dev etc home lib media mnt
# opt proc root run srv sys tmp usr varLocate config and logs by FHS
Demonstrates that FHS tells you exactly where to find configs (/etc), logs (/var/log), and temp files (/tmp).
# Configuration always lives in /etc
ls /etc/nginx/
# Variable data and logs always in /var
ls /var/log/
# Temporary files in /tmp (cleared on reboot)
ls /tmp/Find binary locations by FHS
Shows how the FHS separates system binaries (/bin, /sbin) from locally installed software (/usr/local/bin).
# System-essential binaries
ls /bin/
# User-installed binaries
ls /usr/local/bin/
# Where is a specific binary?
which nginx
# /usr/sbin/nginx
Discussion