DEV Community

John  Ajera
John Ajera

Posted on

Linux Directory Structure Explained

📂 Understanding the Linux Directory Structure

When you first dive into Linux, the sheer number of top-level directories in / can be overwhelming. But each one has a purpose and a reason to exist. Let’s break down what these directories are and what they're typically used for.

💡 Tip: All paths below are rooted at /, the filesystem root.


📁 Top-Level Directories

Path Name Description
/boot Boot Loader Files Contains files needed for the boot process like the kernel and initrd.
/etc Configuration Files System-wide configuration files for services, networking, etc.
/home User Home Directories Contains personal directories like /home/alice, /home/bob, etc.
/root Root Home Directory Home directory for the root user, separate from /home.
/opt Third-Party Applications Optional and third-party software is typically installed here.
/dev Device Files Represents hardware devices like /dev/sda, /dev/null, etc.
/var Variable Files Dynamic files such as logs, mail spools, and application data.
/bin User Binaries Essential command-line programs available to all users.
/sbin System Binaries System-level binaries for administration, mostly used by root.
/usr User Applications Contains user-space programs, libraries, and documentation.
/proc Process Information Virtual filesystem providing real-time system and process information.
/mnt Mount Directory Temporary mount point for filesystems mounted manually.
/sys Virtual File System Interface to the kernel and device tree, mainly for system info/config.
/media Removable Devices Auto-mounted removable media (USB drives, CDs) appear here.
/run Temporary File System Stores transient runtime data (PID files, sockets) cleared on reboot.
/tmp Temporary Files Used to store temporary files; typically cleared on reboot.
/lost+found Recover Broken Files Holds recovered files after a system crash or filesystem error (ext* only).
/lib System Libraries Shared libraries used by binaries in /bin and /sbin.
/srv Service Data Directory Contains data served by system services (e.g., web, FTP).

🧠 TL;DR

The Linux filesystem isn’t random—it’s a well-organized layout with each directory serving a specific purpose. Understanding it helps you navigate and manage a Linux system more effectively.


📝 Have you explored these directories before? What's your favorite Linux tip or command? Drop it in the comments!

Top comments (0)