Fundamentals 9 min read

Understanding the Linux Filesystem Hierarchy Standard (FHS)

This article explains the history, purpose, and structure of the Linux Filesystem Hierarchy Standard (FHS), detailing the classification of directories, their typical contents such as /, /usr, /var, and the distinctions between shareable, non‑shareable, immutable, and mutable directories, with practical examples.

360 Quality & Efficiency
360 Quality & Efficiency
360 Quality & Efficiency
Understanding the Linux Filesystem Hierarchy Standard (FHS)

Linux distributions often have similar file and directory layouts, but differences can cause confusion for users who encounter varying directory structures across distributions.

To address this, a Filesystem Hierarchy Standard (FHS) was developed: an early Filesystem Standard (FSSTND) appeared in 1994, and the FHS itself was finalized in early 1996 with help from the BSD community.

FHS defines the main directories and their layout in Linux, providing guidelines on required files and directories, exceptions, and historical conflicts so that users and applications can predict where files reside.

The standard classifies directories into four interaction types:

Shareable – directories that can be shared across systems (e.g., user mail).

Non‑shareable – directories tied to the local machine (e.g., device files).

Immutable – data that does not change between distributions (e.g., libraries, admin‑managed configuration).

Mutable – frequently changing data (e.g., log files).

FHS primarily defines three top‑level directories:

/ – the root directory, related to system boot and recovery.

/usr – UNIX Software Resources, containing installed software.

/var – variable data such as caches and logs.

The root directory ( / ) is the most critical; it should be kept small and separate from application partitions for performance and security. Important subdirectories include:

/bin – essential commands usable in single‑user mode.

/boot – boot loader files.

/dev – device files representing hardware.

/etc – system configuration files.

/home – user home directories.

/lib – shared libraries needed by the kernel and binaries.

/media – automatically mounted removable media.

/mnt – temporary mount points for manual mounts.

/opt – third‑party software.

/root – root user’s home directory.

/sbin – system administration binaries.

/srv – data for specific services.

/tmp – temporary files, cleared on boot.

Differences among /mnt , /media , and /dev :

/mnt – empty by default, used for manual temporary mounts.

/media – automatically populated when removable media are inserted.

/dev – provides device node files that act as interfaces to hardware.

The /usr hierarchy stores software resources and is organized into subdirectories such as:

/usr/bin – user‑level executable programs.

/usr/sbin – system administration binaries not required for basic boot.

/usr/include – header files for programming languages.

/usr/lib (and /usr/lib64) – libraries for applications.

/usr/local – locally compiled or installed software.

/usr/share – architecture‑independent shared data (e.g., documentation).

/usr/src – source code, including the kernel source.

The /var hierarchy holds variable data:

/var/cache – application cache files.

/var/lib – state information for applications.

/var/log – log files.

/var/run – PID files for running services.

/var/spool – queued data such as mail.

As long as a distribution follows the FHS, internal sub‑directory structures may differ, allowing each distro to implement its own custom layout while maintaining overall compatibility.

References:

https://zh.wikipedia.org/wiki/文件系统层次结构标准

鸟哥的Linux私房菜

http://blog.csdn.net/kkdelta/article/details/7708250

LinuxDirectory StructureOperating SystemfundamentalsfilesystemFHS
360 Quality & Efficiency
Written by

360 Quality & Efficiency

360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.

0 followers
Reader feedback

How this landed with the community

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