File System Hierarchy of Linux

Linux File Hierarchy Structure by Aman

File System Hierarchy of Linux

The File System Hierarchy Standard (FHS) is a set of conventions and standards for the layout of directories and files on Linux systems. It defines the structure and the content of the file system, providing guidelines for the placement of files and directories. Keep in mind that the FHS may vary slightly between different Linux distributions, but most adhere to the same basic principles. Here is an overview of the main directories in the Linux file system hierarchy:

  1. / (Root Directory):

    • The top-level directory in the file system hierarchy.

    • All other directories and files are under this directory.

  2. /bin (Binaries):

    • Contains essential binary executables (commands) needed for system recovery and maintenance.
  3. /boot:

    • Contains files needed for the boot process, including the kernel, bootloader configuration, and other essential files.
  4. /dev (Device files):

    • Contains device files representing hardware devices (e.g., /dev/sda for the first hard drive).
  5. /etc (System Configuration Files):

    • Contains system-wide configuration files and shell scripts executed during the boot process or system initialization.
  6. /home (User Home Directories):

    • Contains user home directories, where users store their personal files and settings.
  7. /lib (Libraries):

    • Contains shared libraries needed by system binaries and some essential system files.
  8. /media:

    • Mount point for removable media such as USB drives, CD-ROMs, etc.
  9. /mnt (Mount Point):

    • A general-purpose mount point for mounting temporary file systems or storage devices.
  10. /opt (Optional):

    • Reserved for software packages installed by the system administrator.
  11. /proc (Process Information):

    • Contains information about system processes and kernel parameters. It is a virtual file system dynamically generated by the kernel.
  12. /root (Root Home Directory):

    • The home directory for the root user.
  13. /run:

    • A directory for system runtime data, including information about running processes and the system state since the last boot.
  14. /sbin (System Binaries):

    • Contains binary executables used for system administration tasks. Similar to /bin, but these are typically reserved for root.
  15. /srv (Service Data):

    • Contains site-specific data that is served by the system.
  16. /sys (Sysfs):

    • A virtual file system exposing kernel-related information and configuration settings.
  17. /tmp (Temporary):

    • Used for temporary files that may be deleted upon reboot.
  18. /usr (User Binaries and Data):

    • Contains subdirectories with binaries, libraries, documentation, and source code for the system's user programs.
  19. /var (Variable Data):

    • Contains variable data, such as logs, spool files, and temporary files that may persist between boots.