Linux Filesystem cheatsheet
| Dir | What’s in there | Quick vibe |
|---|---|---|
/etc | System-wide config (fstab, ssh/, apt/…) | Brain – tweak here, bend the OS |
/bin | Core binaries (ls, cp, bash) | First-aid toolkit; always present, even in rescue mode |
/sbin | Sysadmin binaries (mount, ip, systemctl) | Same as /bin but root-only toys |
/usr/bin | Full app set (gcc, python) | Userland galaxy – 90 % of commands |
/usr/sbin | Heavier daemons (sshd, cron) | Admin apps still in userland |
/usr/local | Locally compiled stuff | Keeps your builds safe from the distro’s package manager |
/var | Logs, spool, caches, DB files | Growing stomach – watch disk usage |
/run (/var/run) | Volatile runtime state (PIDs, sockets) | tmpfs in RAM, born early at boot |
/home | Users’ dirs | You, your dotfiles, your mess |
/opt | 3rd-party bundles (Chrome, VMware) | Vendor playground; easy to nuke |
/dev | Device nodes (/dev/sda, /dev/null) | “Everything’s a file” made real |
/proc | Kernel + process pseudo-FS | cat /proc/cpuinfo = free hardware probe |
/sys | Kernel objects, drivers | Modern cousin of /proc; tweak power/LEDs |
/tmp | Scratch space | Auto-purged; don’t stash secrets |
/boot | Kernel & bootloader bits (vmlinuz, grub/) | Small, often its own partition |
Why the weird names?
usr≠ “user” originally—Unix System Resources (/usr/bin).sbin= system binaries (super-user land).optfrom optional add-ons in SVR4 days.runsplit from/varso early-boot services get instant writable RAM.
Quick cross-OS compare
| OS | Root | Apps live in | User homes | Mount style |
|---|---|---|---|---|
| 🐧 Linux/*BSD | / | /usr/bin, /opt | /home/ivan | Any device mounts anywhere (/mnt/usb) via fstab |
| macOS | / | /Applications (GUI), /usr/bin (CLI) | /Users/ivan | External drives auto-mount under /Volumes |
| Windows | C:\ | C:\Program Files / Program Files (x86) | C:\Users\Ivan | Letters (D:\, E:\) instead of grafting into a single tree |
Handy aliases & shortcuts
~→ home dir (/home/ivan,/Users/ivan)..= current dir,..= parent./var/run→ symlink to/runon modern distros./bin&/sbinoften symlink to/usr/bin&/usr/sbin(the usr-merge trend).
Mounting in one breath
Linux glues extra filesystems into the tree:
mount /dev/sdb1 /media/usb
macOS auto-mounts to/Volumes/DriveName,
Windows splits the forests into drive letters.
TODOs
- Break out
/proc&/sysdeep dive - Write a note on permissions &
chmodoctals - Draft a Mac vs Linux path mash-up table