Skip to content

Linux File Hierarchy: Understanding the FHS for Unix‐like Systems

Mahesh Shukla - Aka JailBreaker 🚀 edited this page Jun 14, 2024 · 1 revision

Linux File Hierarchy Structure

The Linux File Hierarchy Structure (FHS) or Filesystem Hierarchy Standard defines the directory structure and contents in Unix-like operating systems. It is maintained by the Linux Foundation.

/ (Root):

  • Primary hierarchy root and root directory of the entire file system hierarchy.
  • Every single file and directory starts from the root directory.
  • Only the root user has the right to write under this directory.
  • /root is the root user’s home directory, which is not the same as /.

1

/bin:

  • Essential command binaries that need to be available in single-user mode and for all users.
  • Contains binary executables for common Linux commands used in single-user modes and by all users of the system.

2

/boot:

  • Boot loader files, such as kernels and initrd.

3

/dev:

  • Essential device files, such as /dev/null, terminal devices, and USB devices.

4

/etc:

  • Host-specific system-wide configuration files, including startup and shutdown scripts.
  • Contains configuration files required by all programs.

8

/home:

  • Users’ home directories, containing saved files and personal settings.

5

/lib:

  • Libraries essential for binaries in /bin and /sbin.

6

/media:

  • Mount points for removable media such as CD-ROMs.

7

/mnt:

  • Temporarily mounted filesystems.

9

/opt:

  • Optional application software packages.

10

/sbin:

  • Essential system binaries used by system administrators for maintenance purposes.

11

/srv:

  • Site-specific data served by the system, such as data for web servers and version control systems.

12

/tmp:

  • Temporary files that are not preserved between system reboots.

13

/usr:

  • Secondary hierarchy for read-only user data and contains utilities and applications for users.
  • /usr/bin contains binary files for user programs, and /usr/sbin contains binaries for system administrators.
  • Libraries, documentation, and source code are also found in /usr.

14

/proc:

  • Virtual filesystem providing process and kernel information as files.
  • Contains information about running processes and system resources.

15

Modern Linux distributions include a /run directory as a temporary filesystem (tmpfs) which stores volatile runtime data, following the FHS version 3.0.

Conclusion

Understanding the Linux File Hierarchy Structure is crucial for navigating and managing Unix-like operating systems effectively. By familiarizing yourself with the key directories and their purposes, you gain insights into how the system is organized and where to find essential files and configurations. Whether you're a system administrator, developer, or Linux enthusiast, mastering the FHS enhances your ability to work efficiently within the Linux environment.

Happy exploring and navigating the Linux filesystem!


References:

  1. Filesystem Hierarchy Standard (FHS)
  2. Linux Filesystem Hierarchy
  3. Understanding the Linux Directory Structure
  4. Linux Documentation