Class 23 of 55 • File System & Storage

Linux Directory Structure: Filesystem Hierarchy Standard (FHS 3.0)

 1. What is the Filesystem Hierarchy Standard (FHS)?

 The Filesystem Hierarchy Standard (FHS) is an internationally recognized standard maintained by the Linux Foundation that specifies the standard directory structure, file placements, and access permissions for Linux and Unix-like operating systems. Currently at version FHS 3.0, this standard ensures that regardless of whether you are running Ubuntu, Red Hat Enterprise Linux, Arch, Fedora, or openSUSE, you can always find configurations in /etc, system logs in /var/log, and kernel abstractions in /proc.

 The entire Linux filesystem is organized as a single inverted tree hierarchy. It originates from the Root Directory, denoted by a single forward slash (/). All other folders, hard drive partitions, optical drives, and network mounts branch out beneath this root node.

 2. Visual Linux FHS Architectural Tree

 The following comprehensive SVG architectural diagram illustrates the complete branching structure of standard Linux directories:

Linux Filesystem Hierarchy Standard Tree Diagram

 3. Comprehensive Breakdown of All Standard Linux Directories

 Let us examine the precise technical role and contents of every primary directory defined by FHS 3.0:

Directory Full Name Technical Purpose & Critical Contents
/ Root The ultimate top-level parent directory. Every file, directory, partition, and mounted device exists underneath this root.
/bin User Binaries Essential command binaries needed in single-user mode and by all users (e.g., ls, cp, mv, rm, cat, bash). (See UsrMerge section below).
/sbin System Binaries Essential administrative binaries primarily reserved for root/sysadmins for booting, repairing, and restoring the system (e.g., fdisk, iptables, reboot, ip).
/boot Boot Loader Files Static files required to boot Linux: the compiled Linux kernel (vmlinuz), Initial RAM disk (initramfs), and GRUB2 bootloader configuration files.
/dev Device Files Special character and block device nodes dynamically managed by the kernel's udev daemon. Grants software access to hardware devices (e.g., /dev/sda disk, /dev/null black hole, /dev/urandom).
/etc Editable Text Configurations Host-specific static configuration files for all installed services and daemons. Contains no binary executables. Examples: /etc/passwd, /etc/fstab, /etc/hosts, /etc/ssh/sshd_config.
/home User Workspaces Personal home directories for regular users to store documents, source code, and user-level configuration dotfiles (e.g., /home/student/, ~/.bashrc).
/root Root Home Home directory for the root superuser account. Kept separate on the root partition so administrator access works even if the /home partition fails to mount.
/lib, /lib64 System Shared Libraries Essential shared object libraries (.so files) and kernel modules required by binaries in /bin and /sbin.
/media Removable Media Automatic mount point for plug-and-play removable drives: USB thumb drives, external hard disks, and CD-ROMs (e.g., /media/student/MY_USB).
/mnt Manual Mounts Temporarily mounted filesystems manually attached by the system administrator (e.g., mounting an NFS network share or recovery partition).
/opt Optional Add-on Software Reserved for self-contained, third-party proprietary applications that do not conform to standard distro packaging (e.g., Google Chrome in /opt/google/chrome).
/proc Process Pseudo-Filesystem Virtual filesystem generated in RAM by the Linux kernel. Contains real-time metrics on running processes (indexed by PID) and hardware statistics (/proc/cpuinfo, /proc/meminfo).
/sys Sysfs Kernel Subsystem Modern virtual pseudo-filesystem exporting information about hardware devices, drivers, and kernel subsystems (power management, thermal sensors, PCIe bus).
/tmp Temporary Files Storage for temporary files created by applications. Often mounted on tmpfs (RAM) and automatically purged on every reboot.
/usr Unix System Resources Secondary hierarchy holding read-only, shareable user applications, libraries, documentation, and source code. Contains /usr/bin, /usr/lib, /usr/local, and /usr/share.
/var Variable Data Files that dynamically expand during continuous system operation: system logs (/var/log), package caches (/var/cache), databases (/var/lib), and spool queues.
/srv Server Data Site-specific payload data served by services running on this host (e.g., web server data, FTP roots, rsync mirrors).
/run Runtime State Data Volatile runtime state since last boot (PID lock files, systemd sockets, tmpfs).

 4. The Modern "UsrMerge" Evolution

 In early Unix computing (1970s), hard disks were tiny (e.g., 2.5 MB). The system was split between /bin (which fit on the tiny root disk) and /usr/bin (which resided on a secondary hard drive). Modern computers have huge gigabyte and terabyte drives, rendering this physical division obsolete.

 Today, modern distributions (Ubuntu 20.04+, Debian 12+, RHEL 9+, Arch Linux) have implemented UsrMerge. If you run ls -l /, you will observe that:

/bin   -> usr/bin
/sbin  -> usr/bin   (or usr/sbin)
/lib   -> usr/lib
/lib64 -> usr/lib64

 All executable binaries now reside in /usr/bin, with symbolic links providing seamless backwards compatibility for legacy Unix shell scripts.

 5. Practical Lab: Navigating and Inspecting the FHS

 Execute these practical terminal commands to inspect your live Linux filesystem tree:

Step 1: Inspecting the Root Hierarchy

# Display top-level root directories with symlink targets:
ls -ld /*

# View directory tree up to 1 level deep:
tree -L 1 /

Step 2: Inspecting Kernel State in /proc

# Check CPU architecture and core details:
cat /proc/cpuinfo | grep "model name" | head -n 1

# Check total and available system memory:
grep MemTotal /proc/meminfo

# Check system uptime in seconds:
cat /proc/uptime

# Inspect the command line that booted the current process (PID 1):
cat /proc/1/cmdline && echo ""

Step 3: Finding Largest Directories in /var

As a system administrator, /var is where disks run out of space due to unrotated log files:

# Check disk space consumed by directories under /var:
sudo du -sh /var/* | sort -h

# Inspect active system logs in real time:
sudo tail -f /var/log/syslog   # On Debian/Ubuntu
# OR:
sudo tail -f /var/log/messages # On RHEL/Rocky

 6. Student Q&A and Viva Preparation

The Filesystem Hierarchy Standard (FHS) is a formal specification maintained by the Linux Foundation that defines the directory structure and directory contents in Linux and Unix-like operating systems. It guarantees that software applications, system administrators, and automated scripts can predict the exact locations of binaries, configurations, libraries, and log files across different Linux distributions.
/bin historically held essential binaries required during single-user mode for all users. /sbin contained essential administrative binaries (like fdisk, reboot). /usr/bin contains non-essential user utilities managed by package managers (APT/DNF), while /usr/local/bin is reserved for locally compiled software or custom admin scripts that must survive system package updates.
/proc (Process Information Pseudo-Filesystem) does not consume space on a physical hard drive. It is dynamically generated in RAM by the Linux kernel. It acts as an interactive window into active processes (organized by PID) and hardware parameters (like /proc/cpuinfo and /proc/meminfo) that can be read or tuned using standard file tools.
/etc contains host-specific, static configuration files (editable plain text). /var holds variable data that dynamically grows during system operation (system logs in /var/log, mail spools, and databases). /tmp stores temporary files generated by running programs that are cleared automatically upon system reboot.
UsrMerge is an architectural unification adopted by Debian, Ubuntu, Fedora, and Arch where legacy directories /bin, /sbin, and /lib are turned into symbolic links pointing to their counterparts inside /usr (/usr/bin, /usr/sbin, /usr/lib). This simplifies package management, snapshot backups, and network mounting.

 7. Summary & Next Steps

 The Filesystem Hierarchy Standard is the map of every Linux operating system. In the next tutorial, we learn how to partition disks, format storage filesystems, mount volumes persistently in /etc/fstab, and manage volumes dynamically in Class 24: Linux Storage Management, fdisk, & LVM.

Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!