DEV Community

John  Ajera
John Ajera

Posted on

2

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!

Warp.dev image

The best coding agent. Backed by benchmarks.

Warp outperforms every other coding agent on the market, and gives you full control over which model you use. Get started now for free, or upgrade and unlock 2.5x AI credits on Warp's paid plans.

Download Warp

Top comments (0)

ITRS image

See What Users Experience in The Browser — Anywhere, Anytime

Simulate logins, checkouts, and payments on SaaS, APIs, and internal apps. Catch issues early, baseline web performance, and stay ahead of incidents. Easily record user journeys right from your browser.

Start Free Trial

👋 Kindness is contagious

Explore this insightful write-up, celebrated by our thriving DEV Community. Developers everywhere are invited to contribute and elevate our shared expertise.

A simple "thank you" can brighten someone’s day—leave your appreciation in the comments!

On DEV, knowledge-sharing fuels our progress and strengthens our community ties. Found this useful? A quick thank you to the author makes all the difference.

Okay