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!

Image of Datadog

Diagram Like A Pro

Bring your cloud architecture to life with expert tips from AWS and Datadog. In this ebook, AWS Solutions Architects Jason Mimick and James Wenzel reveal pro strategies for building clear, compelling diagrams that make an impact.

Get the Guide

Top comments (0)

Billboard image

Try REST API Generation for Snowflake

DevOps for Private APIs. Automate the building, securing, and documenting of internal/private REST APIs with built-in enterprise security on bare-metal, VMs, or containers.

  • Auto-generated live APIs mapped from Snowflake database schema
  • Interactive Swagger API documentation
  • Scripting engine to customize your API
  • Built-in role-based access control

Learn more

👋 Kindness is contagious

Value this insightful article and join the thriving DEV Community. Developers of every skill level are encouraged to contribute and expand our collective knowledge.

A simple “thank you” can uplift someone’s spirits. Leave your appreciation in the comments!

On DEV, exchanging expertise lightens our path and reinforces our bonds. Enjoyed the read? A quick note of thanks to the author means a lot.

Okay