Master Linux Filesystem Hierarchy: Where Every Directory Belongs
This guide demystifies the Linux Filesystem Hierarchy Standard by explaining the purpose of each top‑level directory—such as /bin, /etc, /home, /var, and others—and shows where different types of files should be stored for a clean, maintainable system.
Linux’s directory layout can be confusing, but understanding the role of each top‑level folder helps you place files correctly and keep the system organized.
/bin
This directory holds essential executable binaries needed during boot, such as ls and top. If /usr/bin is unavailable, /bin may be used as a fallback symlink.
/boot
Contains the kernel, bootloader (e.g., GRUB), and EFI files required to start the operating system. Damage to this directory can prevent the system from booting.
/dev
Short for “device”, it provides references to hardware and virtual devices (hard disks, USB sticks, terminals, null device, etc.). Accessing a device from the command line usually involves a file under /dev.
/etc
Stores all core configuration files for the system and installed applications. Modify files here to change program behavior, network settings, or cron jobs.
/home
Top‑level directory for user home directories. Each user’s personal files—documents, music, pictures—belong here, accessed via ~. Shared program configuration or system data should not be placed in /home.
/lib, /lib32, /lib64, …
Contain shared C libraries and kernel modules required by binaries in /bin and /sbin. Architecture‑specific libraries reside in the corresponding lib subdirectory.
/lost+found
Used by the filesystem to store recovered fragments of corrupted files after crashes or hardware failures.
/media
Mount point for removable media such as CDs, USB drives, or ISO images. Historically also used for floppy and Zip disks.
/mnt
A generic mount point for temporarily mounting external disks, NFS shares, or other filesystems.
/opt
Originally intended for optional third‑party software packages that are not part of the base distribution. Many distributions still use it for large, self‑contained applications.
/proc
A virtual filesystem exposing kernel and process information. Files here are not real data but interfaces to view metrics such as memory usage, process IDs, and system configuration.
/root
Home directory of the root (superuser) account. It resides at /root instead of /home/root for security reasons.
/run
Holds runtime data such as PID files, lock files, and sockets. It is cleared on reboot and is not meant for persistent storage.
/sbin
Contains system binaries used for administrative tasks (e.g., fdisk, usermod). Unlike /bin, these are typically not needed by regular users.
/srv
Intended for data served by the system, such as web server files, FTP data, or other service‑specific resources.
/sys
Similar to /proc, it provides structured information about devices and kernel subsystems, depending on the distribution.
/tmp
Temporary storage for files that do not need to survive a reboot. The system may clean this directory automatically.
/usr
Described by the FHS as “shareable, read‑only data”. It can be mounted read‑only on other systems. In practice it holds architecture‑independent data, libraries, and user‑installed software (e.g., /usr/share, /usr/local).
/var
Stores variable data that changes at runtime: printer spools, lock files, package caches, email, logs, etc. Subdirectory /var/local is often used for miscellaneous configuration files.
Understanding these directories and their intended contents makes the Linux filesystem intuitive and helps you maintain a clean, well‑organized system.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
