File System Hierarchy
Master the Linux directory structure and understand the purpose of each system directory.
The Filesystem Hierarchy Standard (FHS)
Linux follows a standardized directory structure defined by the FHS. Understanding this structure is essential for system administration.
Key Directories
/ Root directory - the top of the filesystem hierarchy.
/home User home directories. Each user has a subdirectory here (e.g., /home/pranav).
/etc System configuration files. Critical configs like /etc/passwd, /etc/fstab live here.
/var Variable data - logs (/var/log), mail, temporary files, databases.
/usr User programs and data. Contains /usr/bin, /usr/lib, /usr/share.
/tmp Temporary files. Cleared on reboot on most systems.
/bin & /sbin Essential system binaries and admin commands.
/proc Virtual filesystem providing process and kernel information.
bin boot dev etc home lib media mnt opt proc root run sbin srv sys tmp usr var
More Directories Youâll See Often
/dev Device files (disks, terminals, random, etc.). Think âhardware as filesâ.
/sys Kernel and device information (sysfs). Useful for tuning and introspection.
/run Runtime state (PID files, sockets). Usually tmpfs (clears on reboot).
/boot Bootloader files, kernels, initramfs. Be carefulâchanges here can prevent boot.
/lib, /lib64 Essential shared libraries used by system binaries and early boot.
/opt Optional thirdâparty software installed outside the distro package manager.
/srv Data served by services (sometimes used for web/app data depending on org conventions).
/mnt, /media Mount points for temporary mounts (/mnt) and removable media (/media).
/root Root userâs home directory (not the filesystem root /).
Modern Distros: â/usr mergeâ and symlinks
Many modern Linux distributions have âmergedâ /bin, /sbin, and /lib into /usr
and keep the old paths as symlinks. Thatâs why you may see /bin pointing to /usr/bin.
lrwxrwxrwx 1 root root ... /bin -> usr/bin
lrwxrwxrwx 1 root root ... /sbin -> usr/sbin
lrwxrwxrwx 1 root root ... /lib -> usr/lib
$ readlink -f /bin
/usr/bin
Mount Points: One Tree, Many Filesystems
Linux presents everything as a single directory tree, but parts of it can be backed by different filesystems (disk partitions, tmpfs, NFS, etc.). Understanding mounts is critical for troubleshooting âdisk fullâ issues and performance.
$ findmnt
$ df -h
$ df -i # inode usage (common âdisk fullâ culprit)
File Types (Quick Recognition)
ls -l shows file types in the first character:
- â˘
-regular file - â˘
ddirectory - â˘
lsymlink - â˘
ccharacter device (e.g., terminals) - â˘
bblock device (e.g., disks) - â˘
ssocket (common in/run) - â˘
pnamed pipe
â Practice (10â15 minutes)
- Run
findmntand identify which filesystem backs/,/home, and/varon your machine. - Use
df -iand learn the difference between inode exhaustion vs space exhaustion. - Pick a file in
/etcand runstat /etc/hoststo inspect inode, permissions, and timestamps.