Filesystem Hierarchy Standard (FHS) in Linux

Youssef Idlahsen

Youssef IdlahsenMar 1, 2023

3 min read548 words

Filesystem Hierarchy Standard

Filesystem Hierarchy Standard (FHS) is a set of guidelines that defines the organization and layout of files and directories in a Linux operating system. FHS was developed to provide a standardized structure for Linux filesystems, so that different Linux distributions and applications can work together seamlessly.

Linux Filesystem Hierarchy

By adhering to the FHS, Linux users can expect to find files and directories in the same locations across different systems, simplifying system administration, software installation, and troubleshooting. The FHS also ensures that system files and user data are stored in separate directories, improving system security and stability.

Directory structure

Directory Purpose
/ The root directory, which contains all other directories and files in the system.
/bin Essential user command binaries that are required to boot the system and perform basic system operations.
/boot Contains the files necessary for the boot process, including the kernel and bootloader configuration files.
/dev Contains device files that represent hardware devices connected to the system.
/etc Contains system-wide configuration files, including user authentication and network configuration files.
/home Contains user home directories, where users can store their personal files and configurations.
/lib Essential shared libraries and kernel modules required for system operation.
/media Mount point for removable media, such as USB drives or CD-ROMs.
/mnt Mount point for temporarily mounted filesystems.
/opt Optional application software packages.
/proc Virtual filesystem that provides information about system processes and kernel configuration.
/root Home directory for the system administrator, also known as the superuser.
/run Contains runtime data for system services, such as PID files and Unix domain sockets.
/sbin Essential system binaries used for system administration tasks.
/srv Contains data for services provided by the system, such as websites or FTP servers.
/sys Virtual filesystem that provides information about hardware devices and kernel configuration.
/tmp Temporary files created by applications or system processes.
/usr Contains the majority of user utilities and applications, including documentation and libraries.
/var Contains variable data files, such as log files, mail spools, and databases.
  • "/etc" (Host-specific system-wide configuration files) has sparked controversy over its meaning. In early versions of the UNIX Implementation Document from Bell labs, this directory was referred to as the "etcetera directory" because it historically held everything that did not belong elsewhere. However, the Filesystem Hierarchy Standard (FHS) now restricts /etc to static configuration files and prohibits it from containing binaries.

FHS compliance

Compliance with the FHS is important for several reasons.

  • It promotes consistency and compatibility between different Linux distributions, making it easier to develop and distribute software that can run on multiple systems.
  • It simplifies system administration and maintenance by providing a standardized directory structure that is easy to understand and navigate.

To ensure FHS compliance, Linux distributions include tools and utilities that enforce the standard directory structure and provide guidelines for developers and system administrators to follow. Additionally, system administrators can manually check their system's compliance by reviewing the directory structure and ensuring that it conforms to the FHS guidelines.

Youssef's Newsletter

Trust me, I won't spam you.

Share on Social Media: