Your Resource for Linux Learning

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

/ (root)
/bin Essential user binaries
/boot Boot loader files
/dev Device files
/etc System configuration files
/home User home directories
/lib Essential shared libraries
/media Removable media mount point
/mnt Temporary mount point
/opt Optional software packages
/proc Virtual filesystem for system information
/root Root user's home directory
/run Runtime variable data
/sbin System binaries
/srv Service data
/sys Virtual filesystem for system information
/tmp Temporary files
/usr User utilities and applications
/var Variable files

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.

Warning: Deleting or modifying system directories like /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)

Next Steps

Now that you've learned the essential Linux commands, you can: