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:
/ (Root Directory):
The top-level directory in the file system hierarchy.
All other directories and files are under this directory.
/bin (Binaries):
- Contains essential binary executables (commands) needed for system recovery and maintenance.
/boot:
- Contains files needed for the boot process, including the kernel, bootloader configuration, and other essential files.
/dev (Device files):
- Contains device files representing hardware devices (e.g., /dev/sda for the first hard drive).
/etc (System Configuration Files):
- Contains system-wide configuration files and shell scripts executed during the boot process or system initialization.
/home (User Home Directories):
- Contains user home directories, where users store their personal files and settings.
/lib (Libraries):
- Contains shared libraries needed by system binaries and some essential system files.
/media:
- Mount point for removable media such as USB drives, CD-ROMs, etc.
/mnt (Mount Point):
- A general-purpose mount point for mounting temporary file systems or storage devices.
/opt (Optional):
- Reserved for software packages installed by the system administrator.
/proc (Process Information):
- Contains information about system processes and kernel parameters. It is a virtual file system dynamically generated by the kernel.
/root (Root Home Directory):
- The home directory for the root user.
/run:
- A directory for system runtime data, including information about running processes and the system state since the last boot.
/sbin (System Binaries):
- Contains binary executables used for system administration tasks. Similar to /bin, but these are typically reserved for root.
/srv (Service Data):
- Contains site-specific data that is served by the system.
/sys (Sysfs):
- A virtual file system exposing kernel-related information and configuration settings.
/tmp (Temporary):
- Used for temporary files that may be deleted upon reboot.
/usr (User Binaries and Data):
- Contains subdirectories with binaries, libraries, documentation, and source code for the system's user programs.
/var (Variable Data):
- Contains variable data, such as logs, spool files, and temporary files that may persist between boots.
Subscribe to my newsletter
Read articles from Aman Patel (Amanops) directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Aman Patel (Amanops)
Aman Patel (Amanops)
I am a DevOps/Cloud Engineer who likes to work on Cloud Infrastructure & Automation, CI/CD, Systems Administration, and Monitoring/Observability. I am an Open Source enthusiast and like to contribute back to the community whenever possible.