/ linux / fs
Understanding the Linux filesystem hierarchy is essential for navigating and managing any Linux system. Everything in Linux is a file — from text documents to hardware devices — and they are all organised under a single tree starting at the root (/).
the filesystem hierarchy standard (FHS)
Most Linux distributions follow the Filesystem Hierarchy Standard, which defines the purpose of each top‑level directory. This consistency makes it easier to find files and develop software that works across different distros.
Below is a breakdown of the most important directories you'll encounter.
key directories
The root directory. Every file and directory starts here.
Essential command binaries (e.g., ls, cp, mv) needed for system boot and repair.
Static bootloader files, kernel images, and initramfs.
Device files representing hardware components (e.g., /dev/sda for hard disk).
Host‑specific system configuration files. Often called 'the everything to configure' directory.
Personal directories for regular users. Each user gets a subfolder (e.g., /home/alice).
Essential shared libraries and kernel modules needed by binaries in /bin and /sbin.
Mount point for removable media like USB drives or CDs (automatically mounted).
Temporary mount point for manually mounting filesystems.
Optional application software packages. Often used by third‑party tools.
Virtual filesystem providing process and kernel information as files.
Home directory for the root (superuser) account.
Essential system binaries (e.g., fdisk, ifconfig) primarily for system administration.
Data for services provided by the system (e.g., web server files).
Virtual filesystem that exposes kernel objects (devices, drivers, etc.).
Temporary files. Often cleared on reboot.
Secondary hierarchy for user programs and data. Contains /usr/bin, /usr/lib, /usr/share, etc.
Variable files — logs, spool files, caches, and other data that changes frequently.
mounting and devices
In Linux, storage devices (like hard drives, USBs, or CD‑ROMs) are not accessed directly by drive letters. Instead, they are mounted to a directory, making their contents available under that path. For example, a USB stick might appear as /media/usb.
The /dev directory contains special device files that represent hardware (like /dev/sda for a SATA drive). The mount command attaches a device to a directory, and umount detaches it.
exploring the filesystem
pwd— print current working directoryls— list directory contentscd— change directorytree— display directory structure as a tree (often needs installation)df -h— show disk usage of mounted filesystemsdu -sh— estimate file/folder sizemount— list mounted filesystems or mount a device