Fundamentals 11 min read

Mastering Linux Filesystem Hierarchy: Where Every Directory Belongs

This guide demystifies the Linux filesystem hierarchy by explaining the purpose of each top‑level directory—such as /bin, /etc, /home, /var, and /usr—and shows where common types of files should be placed for a well‑organized system.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Mastering Linux Filesystem Hierarchy: Where Every Directory Belongs

Linux’s directory layout can be confusing, but understanding the role of each top‑level folder helps you store files in the right place and keep the system tidy.

/bin

This directory holds essential executable binaries required for system boot and basic commands like ls and top. If /usr/bin is unavailable during startup, /bin may be symlinked to the top level.

/bin directory illustration
/bin directory illustration

/boot

Contains the kernel, bootloader (e.g., GRUB), and EFI files needed to start the operating system. Problems here can prevent the system from booting.

/dev

Short for “device,” this folder provides references to hardware and virtual devices such as disks, USB peripherals, terminals, and null devices. Accessing a device from the command line typically involves a file under /dev.

/etc

Holds all core configuration files for the system and installed applications. Modify files here to change program behavior, network settings, or scheduled tasks (crontab).

/etc directory illustration
/etc directory illustration

/home

Top‑level directory for user home directories. Each user’s personal files, such as documents, music, and projects, belong here (e.g., /home/username). System‑wide configuration or data should not be stored in /home.

/lib, /lib32, /lib64, …

Contains shared C libraries and kernel modules required by binaries in /bin and /sbin. Architecture‑specific libraries appear in directories like /lib64.

/lost+found

Used by the filesystem to store recovered fragments after crashes or hardware failures.

/media

Mount point for removable media such as CDs, USB drives, or ISO images. Historically used for floppy disks and Zip drives.

/mnt

General‑purpose mount point for temporary mounts of external disks, NFS shares, or other filesystems.

/opt

Originally intended for optional third‑party software packages that are not part of the base distribution. Some distributions still use it for proprietary or additional applications.

/proc

A virtual filesystem exposing kernel and process information. Files here are not real data but interfaces to view metrics like memory usage and process status.

/root

Home directory of the root (superuser) account, separate from regular users’ /home directories for security reasons.

/run

Stores runtime data such as PID files, lock files, and sockets. It is meant for transient information, not persistent data.

/sbin

Contains system binaries used for administrative tasks (e.g., fdisk, usermod). Unlike /bin, these tools are typically reserved for privileged operations.

/srv

Holds data served by the system, such as web server files, FTP directories, or other service‑specific resources.

/sys

Similar to /proc, this virtual filesystem provides structured information about devices and the kernel, depending on the distribution.

/tmp

Temporary storage for files that do not need to persist across reboots. Contents may be cleared automatically.

/usr

Described by the Linux Foundation’s Filesystem Hierarchy Standard (FHS) as “shareable, read‑only data.” It can be mounted read‑only on multiple hosts. In practice, it contains subdirectories like /usr/share, /usr/local, and /usr/local/bin for additional software and scripts.

/var

Short for “variable,” this directory stores data that changes during system operation. Typical contents include:

Printer spools

Lock files

Package manager caches (e.g., apt)

E‑mail data

Log files

It also often contains a /var/local subdirectory for miscellaneous configuration files that don’t fit elsewhere.

Conclusion

The Linux Filesystem Hierarchy is a well‑evolved structure; once you understand the meaning behind each directory name, placing files becomes intuitive and you gain deeper insight into how Linux operates at a fundamental level.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxDirectory StructureUnixFilesystemFHS
Liangxu Linux
Written by

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.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.