📜 Part of Pranav Kulkarni's technical portfolio Visit pranavkulkarni.org →
Lesson 3 ¡ Fundamentals

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.

$ ls /
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.

$ ls -ld /bin /sbin /lib
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.

$ mount | head
$ 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
  • •d directory
  • •l symlink
  • •c character device (e.g., terminals)
  • •b block device (e.g., disks)
  • •s socket (common in /run)
  • •p named pipe

✅ Practice (10–15 minutes)

  • Run findmnt and identify which filesystem backs /, /home, and /var on your machine.
  • Use df -i and learn the difference between inode exhaustion vs space exhaustion.
  • Pick a file in /etc and run stat /etc/hosts to inspect inode, permissions, and timestamps.