The Filesystem Hierarchy: Where Everything Lives
Linux has no C:\ drive — everything hangs off a single root directory /, and each top-level folder has a strict job defined by the Filesystem Hierarchy Standard — learn the map and you can find any config, log, or program on any distro.
Why Learn This?
When someone says “check the logs” or “the config is in /etc”, the answer only makes sense if you know what those directories are. Beginners copy-paste paths from tutorials without understanding them; this page gives you the mental map so the paths stop being magic.
You will never need to memorize every directory. Learn the eight that matter daily —
/,/bin,/etc,/home,/tmp,/var,/usr,/dev— and the rest you can look up the moment you need them.
1. Everything Starts at /
There is exactly one tree. Every directory, file, disk, and device lives under the root /:
/
├── bin essential commands
├── etc configuration files
├── home people's files
├── tmp temporary files
├── var logs, spools, changing data
├── usr programs and their data
├── dev devices as files
└── ...
Unlike Windows, there are no drive letters. A second disk or USB stick is mounted into the tree at some directory (often /mnt or /media), becoming part of the one filesystem.
2. The Directories You Will Use Daily
| Directory | What lives there |
|---|---|
/ | The root of everything |
/bin | Essential commands: ls, cp, bash (now often a symlink to /usr/bin) |
/etc | System-wide configuration files, all plain text |
/home | One folder per user: ~, downloads, documents |
/tmp | Temporary files; wiped on reboot |
/var | Things that grow: logs, mail, web content, package caches |
/usr | User programs: /usr/bin, /usr/lib, /usr/share |
/dev | Hardware and virtual devices as files (/dev/sda, /dev/null) |
Example: the pieces of a typical command invocation:
sudo systemctl restart nginx
# ^^^ ^^^^^^^^^ ^ ^^^^^
# | | | └── a unit file in /etc/systemd or /usr/lib/systemd
# | | └----------- the binary /usr/bin/systemctl (or /bin)
# | └---------------------- run as root, config in /etc
# └---------------------------- sudo config in /etc/sudoers
3. /etc: Where Configuration Lives
/etc is the closest thing Linux has to a registry — except every entry is a human-readable text file:
ls /etc
# adduser.conf apt/ environment group hosts network/ passwd ssh/ ...
Key files you will meet early:
/etc/passwd— the list of users/etc/hosts— local hostname → IP mappings/etc/fstab— what gets mounted at boot/etc/os-release— which distro this actually is
Example: check which distro you are on without any command:
cat /etc/os-release
4. /var: Where Things Grow
/var holds files that change size during normal operation:
/var/log— system and application logs (see the monitoring phase later)/var/www— web server content (the classic Apache/Nginx default)/var/cache— package and application caches/var/mail— mailbox files for local users/var/lib— state that must survive restarts (databases live here)
Example: the web server document root most tutorials assume:
ls /var/www/html
5. /usr: Programs and Their Data
Despite the name (historically “user programs”), /usr is not per-user — it holds installed software system-wide:
/usr/bin— most user-facing commands/usr/sbin— administrative commands/usr/lib— libraries programs load/usr/share— architecture-independent data: docs, man pages, icons/usr/local— software you installed by hand, kept separate from the package manager
Example: where a manually installed program’s man page lands:
man man # /usr/share/man/man1/man.1.gz
6. /dev: Devices as Files
Every piece of hardware — and many abstractions — appears as a file in /dev:
ls /dev/null /dev/sda /dev/tty
# /dev/null /dev/sda /dev/tty
/dev/null— the black hole; anything written to it vanishes/dev/sda,/dev/nvme0n1— disks and partitions/dev/tty— your current terminal/dev/random— entropy source
Example: discard output completely:
./noisy-command > /dev/null 2>&1
7. The Directories You Should Recognize but Rarely Touch
| Directory | What it is |
|---|---|
/boot | Kernel and bootloader files |
/proc | A live window into the kernel and running processes |
/sys | Kernel device and driver information |
/opt | Optional: large third-party packages that install themselves |
/mnt | Where you manually mount disks while exploring |
/media | Where desktops auto-mount USB drives |
/run | Runtime data since last boot (PID files, sockets) |
/srv | Data served by this machine (shared files, web content) |
/root | The root user’s home directory — not / |
/proc is the strangest and most fascinating: it is not on disk at all. cat /proc/cpuinfo reads live kernel data:
cat /proc/cpuinfo | head
8. Absolute vs Relative Paths
A path starting with / is absolute — it is complete from the root, always. Everything else is relative to your current directory:
cd /etc/ssl # absolute: unambiguous from anywhere
cd ../etc/ssl # relative: from wherever you are now
cd ./etc/ssl # same as above — ./ means "here"
The shell tracks your position with pwd (covered in CLI Navigation):
pwd
# /home/user/projects
cd ../../etc
# from /home/user/projects → /home/user → /home → ... wait, that is two levels up: /home
Example: ~ is a shorthand for your home directory that the shell expands:
cd ~/downloads
# expands to /home/user/downloads before cd ever runs
Common Pitfalls
- Looking for a
C:drive — there is none; disks are mounted into the single tree, often under/mntor/media. /rootis not/— the root user’s home is/root; the root directory is just/.- Editing files in
/binor/usr/bin— those are managed by the package manager; your edits get overwritten on the next update. Config goes in/etc, your own software in/usr/local. - Filling
/or/var— logs and caches live there; a full root partition breaks the whole system.df -h(see File Operations) tells you the truth. - Assuming
/tmpsurvives reboots — it usually does not; anything important belongs in/var/tmpor your home. - Trusting
/usr= “user” — it has nothing to do with user accounts; it is where the distro keeps installed programs. - Writing to
/procor/syscasually — they are kernel interfaces; “files” there are live data, and some accept writes with real consequences.
Related Pages
| Page | Why it is related |
|---|---|
| What Is Linux? | The distro decides how these directories get filled |
| Terminal vs Shell vs Kernel | /proc and /sys are the kernel showing itself |
| pwd, ls, and friends | The commands for walking this tree |
| du and df | Measuring what fills each directory |
Filesystem Hierarchy Cheatsheet
| Path | What it is |
|---|---|
/ | The one root everything hangs from |
/bin, /usr/bin | Commands (ls, cp, most tools) |
/etc | System configuration, plain text |
/home/user | Your files (~) |
/root | The root user’s home |
/tmp | Temporary, wiped on reboot |
/var/log | Logs |
/var/www | Web content |
/usr/local | Software you installed manually |
/dev/null | The black hole |
/proc | Live kernel/process data |
/mnt, /media | Mounted disks and USB sticks |
/boot | Kernel and bootloader |