Linux File System Hierarchy: Directory Structure

Understanding the Linux directory structure is one of the most important steps after migrating from Windows to Linux. Unlike Windows, Linux uses a standardized file system layout defined by the Filesystem Hierarchy Standard (FHS). For new Linux users, or those coming from Windows, learning the Linux filesystem hierarchy early on will make navigation, management, and troubleshooting much easier.

Linux File System Directory Structure Explained

Linux file system hierarchy and directory structure diagram
Watch: Linux File System Hierarchy - Navigating the Linux Directory Structure

What is the File System Hierarchy Standard (FHS)?

The Filesystem Hierarchy Standard (FHS) defines how files and directories should be organized in Linux and other Unix-like systems.

This standard ensures consistency across Linux distributions such as Ubuntu, Debian, Fedora, and Arch, making it easier to find files, understand system structure, and maintain cross-compatibility.

Linux Directory Structure Overview

Here’s a breakdown of the most important Linux directories and their purposes:

Linux Directory Purpose
/bin Essential user command binaries (e.g., ls, cp, mv) required for system repair and management.
/boot Boot loader files, Linux kernel, and GRUB configuration required to start the system.
/dev Device files representing hardware (hard drives, USBs, terminals, etc.).
/etc System-wide configuration files and startup scripts.
/home User directories where personal files, documents, and settings are stored.
/lib Shared libraries needed by system programs and commands in /bin and /sbin.
/media Automatic mount points for removable media like USB drives and DVDs.
/mnt Temporary mount point for mounting filesystems manually.
/opt Optional third-party software and packages.
/proc Virtual filesystem with runtime system and process information (CPU, memory, kernel settings).
/root Home directory for the root (administrator) user.
/sbin System binaries for administrative tasks (e.g., fsck, reboot).
/srv Data served by services like web servers (/srv/www) or FTP.
/sys Interface to the Linux kernel; provides hardware and device information.
/tmp Temporary files (often cleared on reboot).
/usr User applications, binaries, documentation, and libraries. One of the largest directories.
/var Variable data such as system logs, caches, mail, and print spool files.

Why Understanding Linux Directories Matters

Mastering the Linux file system hierarchy helps you:

  • Navigate the system more efficiently.
  • Manage files and directories with confidence.
  • Troubleshoot system issues faster.
  • Understand Linux permissions and security better.

FAQs About Linux Directory Structure

What is the difference between /bin and /sbin?

/bin contains essential commands for all users, while /sbin holds system binaries used mostly by the root user for administrative tasks.

What is stored in /etc?

/etc contains system configuration files (e.g., /etc/passwd for users, /etc/fstab for mounted filesystems).

Where are user files stored in Linux?

Personal user files and settings are stored under /home/username, similar to the "Users" folders in Windows.