Master Linux Filesystem Hierarchy: Where Every Directory Belongs
Explore the Linux filesystem hierarchy in depth, learning the purpose of each top‑level directory—from /bin and /boot to /var and /usr—and discover where to correctly place different types of files for a clean, well‑organized system.
Imagine staring at a confusing maze of Linux directories, wondering where specific file types belong. Many of us have placed files arbitrarily in /usr/share, only to later discover they belong in /var/local. This article demystifies the Linux directory hierarchy, explaining the meaning of each name and the appropriate locations for common file types.
/bin
This is the primary location for essential executable binaries required by the system during boot. Basic commands such as ls and top reside here. If /usr/bin is unavailable during startup, /bin may be used as a fallback via a symbolic link.
/boot
This directory contains all critical files needed to actually boot the operating system, including the kernel, bootloader files (e.g., GRUB), and EFI files for modern UEFI systems. Problems here can prevent the system from starting.
/dev
/devstands for “device” and holds references to most connected devices—both physical and virtual. Here you’ll find entries for hard drives, USB peripherals, virtual terminals, and even null devices. Any device accessible from the command line typically appears in this directory.
/etc
This directory stores all core configuration files for the system and installed programs. It is the place to modify program behavior, network settings, or crontab entries.
/home
Each user’s personal home directory resides under /home. It provides an isolated space for personal files such as images, music, spreadsheets, or drafts. Shared program configurations or system‑level data should not be stored here.
/lib, /lib32, /lib64, …
These directories contain shared C libraries and kernel modules required by the binaries in /bin. Multiple architecture‑specific directories (e.g., /lib32, /lib64) may exist.
/lost+found
This simple directory holds files that were corrupted but recovered after events like power loss or hardware failure.
/media
A mount point for removable media such as CDs, USB drives, or ISO images. Historically used for floppy disks and Zip drives.
/mnt
A generic mount point for temporary mounts, external disks, NFS shares, or other remote file systems.
/opt
Short for “optional”, this directory is traditionally used for additional software packages that are not part of the core distribution. Many third‑party applications store their static files here.
/proc
A virtual filesystem that provides a window into kernel information. Files here are not real files but expose process, memory, and subsystem metrics that can be read like regular files.
/root
The home directory of the root user, located at /root rather than under /home for security reasons.
/run
Holds runtime data such as PID files, lock files, and sockets. It is intended for transient information, not persistent data.
/sbin
Similar to /bin but contains system binaries used for administrative tasks (e.g., fdisk, usermod). These tools have powerful capabilities for system maintenance.
/srv
Used to store data provided by the system, such as web server files, when the host offers services.
/sys
Present on some distributions, this directory mirrors /proc but presents device and kernel information in a more structured format.
/tmp
A temporary directory for files that do not need to persist across reboots. Contents may be cleared automatically.
/usr
According to the Linux Foundation’s Filesystem Hierarchy Standard (FHS), /usr holds “shared, read‑only data”. It is intended to be portable across hosts and often mounted read‑only. In practice it stores a wide range of files, including /usr/share, /usr/local, and custom scripts.
/var
Short for “variable”, this directory stores data that changes during system operation. Typical contents include printer spools, lock files, package caches, email data, and logs. Subdirectory /var/local is often used for miscellaneous configuration files.
Summary
The Linux filesystem hierarchy is a complex, historically evolved structure. Understanding the meaning behind each top‑level directory makes file placement intuitive and deepens knowledge of how Linux operates at a fundamental level.
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.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
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.
