Linux Directory Structure
Every Linux system has the same basic directory structure. Once you learn it, you can navigate any Linux system - Ubuntu, CentOS, Debian, Arch - they all follow the same layout.
The Filesystem Hierarchy Standard (FHS)
Linux follows the FHS - a standard that defines where files should go. Let's explore the key directories.
The Essential Directories
/ (Root)
The top of the tree. Everything is under this.
/home - User Home Directories
Where users live:
/home/
├── alice/
├── bob/
└── charlie/
Each user gets their own directory. Your stuff is in /home/yourusername.
Root User Exception
The root user's home is /root, not /home/root. This is intentional - even if /home fails to mount, root can still log in.
/etc - Configuration Files
System-wide configs live here:
Key files:
/etc/passwd- User accounts/etc/hosts- Local DNS overrides/etc/ssh/- SSH server config/etc/nginx/- Nginx config (if installed)
"etc" stands for "et cetera" but think of it as "editable text config."
/var - Variable Data
Files that change frequently:
/var/
├── log/ # System logs
├── www/ # Web server files (on some systems)
├── lib/ # Application data
└── cache/ # Cached data
When you need logs, check /var/log.
/tmp - Temporary Files
Scratch space that gets cleared on reboot:
Don't Store Important Data Here
/tmp gets wiped on reboot. Never put anything important here.
/usr - User Programs
Read-only user data. Most programs live here:
/usr/
├── bin/ # User commands (ls, grep, etc.)
├── lib/ # Libraries
├── local/ # Locally installed software
└── share/ # Shared data (docs, icons, etc.)
/bin and /sbin - System Binaries
Essential commands:
/bin- Basic user commands (ls, cp, mv)/sbin- System administration commands (fsck, iptables)
Modern Linux
Many modern distributions merge /bin with /usr/bin and /sbin with /usr/sbin. You'll see them as symbolic links.
/dev - Device Files
Hardware represented as files:
/dev/sda- First hard drive/dev/null- Black hole (discards everything)/dev/random- Random number generator
/proc - Process Information
Virtual filesystem with system info:
/opt - Optional Software
Third-party applications:
/opt/
├── google/
│ └── chrome/
├── slack/
└── zoom/
/mnt and /media - Mount Points
Where external drives appear:
/mnt- Temporary mounts (manual)/media- Removable media (USB drives, CDs)
Quick Reference
| Directory | Purpose |
|---|---|
/ | Root of everything |
/home | User home directories |
/etc | Configuration files |
/var | Variable data (logs, caches) |
/tmp | Temporary files |
/usr | User programs |
/bin, /sbin | Essential binaries |
/dev | Device files |
/proc | Process/system info |
/opt | Optional/third-party software |
/mnt, /media | Mount points |
Where would you look for system log files?
Key Takeaways
- All Linux systems follow the same basic structure
/etc= configs,/var= variable data,/home= users/var/logis your go-to for troubleshooting/tmpgets wiped on reboot - don't trust it/proclets you inspect the running system- Understanding this structure helps on any Linux system
Next: the time-saving magic of tab completion.