Linux File System Hierarchy
The Linux file system follows a hierarchical structure known as the Filesystem Hierarchy Standard (FHS). Understanding this structure is crucial for effective Linux administration and usage. This guide explains the purpose of important directories in a typical Linux system.
What is FHS?
The Filesystem Hierarchy Standard (FHS) defines the directory structure and directory contents in Linux distributions. It ensures consistency between different distributions, making it easier for users and software to navigate the file system.
File System Overview
Key Directories and Their Purposes
/ Root Directory
The root directory is the top-level directory in the filesystem hierarchy. All other directories branch off from this point. It contains essential directories needed to boot and run the system.
/bin Essential User Binaries
This directory contains essential command-line utilities and programs required for the system to operate in single-user mode. Examples include ls
, cp
, and mv
.
/etc Configuration Files
Stores global configuration files for the system and installed applications. Files like passwd
, hosts
, and fstab
are found here.
/home User Home Directories
Contains personal directories for each user. For example, the user alice
will have a home directory located at /home/alice
.
/var Variable Data
Holds variable data like logs, mail spools, and printer spool files. The content of this directory frequently changes as the system runs.
/usr User Binaries and Documentation
This is a secondary hierarchy containing read-only user data, including binaries, documentation, and libraries not needed for basic system boot.
/bin
, /etc
, or /usr
can render your system unusable. Always double-check before making changes.
Summary Table of Key Directories
Directory | Purpose |
---|---|
/boot | Files required for booting the system |
/dev | Device files |
/media | Mount point for removable media |
/opt | Optional software packages |
/tmp | Temporary files (cleared on reboot) |