📂 Understanding the Linux Filesystem Hierarchy – A Complete Guide 🚀
Satyam Ahirrao

Satyam Ahirrao @satyam-ahirrao

About: I'm a Linux SysAdmin exploring the exciting landscape of DevOps. Join me as I document my learning process and share practical advice.

Location:
india
Joined:
Feb 22, 2025

📂 Understanding the Linux Filesystem Hierarchy – A Complete Guide 🚀

Publish Date: Feb 22
47 8

When working with Linux, understanding the Filesystem Hierarchy Standard (FHS) is essential. Unlike Windows, which divides data into multiple drives (C:, D:, etc.), Linux follows a structured, single-rooted system. Let’s explore its core directories and their significance!


🌱 The Root Directory (/) – The Foundation of Linux

At the top of the hierarchy is /, the root directory. Every file and directory in Linux originates from this point. It contains all essential system directories, configuration files, and user data.

Everything in Linux is a file, whether it's a text document, a directory, a hardware device, or a running process.


📂 Key Directories in Linux

1️⃣ /bin – Essential User Binaries 💻

  • Stores essential system executables required for basic operations and booting.
  • Available for all users, even in single-user mode.
  • Examples: ls, cp, mv, grep, cat, echo, rm.

2️⃣ /sbin – System Binaries 🔧

  • Contains administrative commands for system management.
  • Requires root privileges to execute most commands.
  • Examples: shutdown, reboot, fsck, fdisk, iptables, mkfs.

3️⃣ /etc – Configuration Files ⚙️

  • Houses system-wide configuration files and scripts.
  • Modifying files here requires administrative privileges.
  • Examples:
    • /etc/fstab – Defines filesystem mount points.
    • /etc/passwd – Stores user account information.
    • /etc/hostname – Defines the system hostname.
    • /etc/network/interfaces – Manages network configurations.

4️⃣ /home – User Home Directories 🏠

  • Stores personal directories for each user.
  • Each user gets their own space: /home/username/.
  • Contains:
    • Documents 📄
    • Downloads 📥
    • Pictures 🖼️
    • Videos 🎥
    • .bashrc (custom shell configurations).

5️⃣ /root – Root User’s Home Directory 🌳

  • Dedicated home directory for the superuser (root).
  • Provides a secure workspace, separate from standard user directories.

⚠️ Never use root for daily tasks!


6️⃣ /var – Variable Data 🔄

  • Stores frequently changing files, such as logs, mail, and databases.
  • Examples:
    • /var/log/ – System and application logs 📜.
    • /var/spool/ – Mail queue & printer jobs 📩🖨️.
    • /var/cache/ – Temporary application cache data ⚡.

7️⃣ /tmp – Temporary Files 🗑️

  • Stores temporary files created by applications and the system.
  • Often cleared automatically on reboot.

8️⃣ /usr – User Applications & Libraries 📚

A large directory divided into subdirectories:

  • /usr/bin/ – Common user applications (e.g., vim, nano, wget).
  • /usr/sbin/ – System administration binaries (e.g., apachectl).
  • /usr/local/Manually installed software.

9️⃣ /lib & /lib64 – System Libraries 📦

  • Holds shared libraries (.so files) required by binaries in /bin and /sbin.
  • Examples:
    • /lib/x86_64-linux-gnu/libc.so.6 – Standard C library.
    • /lib/modules/ – Kernel modules and drivers.

🔟 /opt – Optional Software 🌟

  • Used for third-party or manually installed software.
  • Common for commercial apps like Google Chrome, Oracle Java, and proprietary drivers.

1️⃣1️⃣ /mnt & /media – Mount Points 🖥️

  • /mnt/ – Temporary mount point for system administrators.
  • /media/ – Auto-mounted external devices like USBs, CDs, and SD cards.

1️⃣2️⃣ /dev – Device Files 🔌

  • Special files representing hardware devices.
  • Examples:
    • /dev/sda – First hard drive. 💾
    • /dev/null – Discard anything written to it. 🗑️
    • /dev/random – Generates random data. 🎲

1️⃣3️⃣ /proc & /sys – Kernel & Process Information 🧠

  • /proc/ – A virtual file system with real-time system information.
    • Examples:
    • /proc/cpuinfo – CPU details. 🖥️
    • /proc/meminfo – Memory usage. 💾
    • /proc/[PID] – Process details.
  • /sys/ – Exposes kernel and hardware configurations.

1️⃣4️⃣ /run – Runtime Data ⚡

  • Stores system-wide runtime data (e.g., PIDs, sockets).
  • Data here is deleted on reboot.

1️⃣5️⃣ /srv – Service Data 🏗️

  • Stores data for system services (e.g., web servers, FTP).
  • Example: /srv/http/ for a web server’s root directory.

1️⃣6️⃣ /lost+found – Recovered Files 🛠️

  • Used by the fsck utility for recovering lost files.
  • Appears in each partition with a Linux filesystem.

🎯 Why Understanding the Linux Filesystem Matters?

Better system navigation – Move around efficiently.

Enhanced troubleshooting skills – Fix errors quickly.

Security awareness – Prevent unauthorized modifications.

Performance optimization – Manage resources effectively.


📌 Conclusion 🎯

The Linux file system is structured for organization, security, and efficiency. Whether you're a beginner or an expert, mastering this hierarchy will make you a better Linux user!

🛠️ Keep exploring, keep learning! 🚀

Comments 8 total

  • Frank Iso
    Frank IsoFeb 23, 2025

    IS IT POSSIBLE TO RECOVER LOST CRYPTO? YES ONLY HACKANGELS

    Hey my name is frank i'm a crypto trader! I just wanted to share my incredible experience with The Hack Angels. They are truly exceptional when it comes to crypto recovery. They managed to recover my lost $1.7 million worth of bitcoin from a scam, which I honestly thought was impossible. If you ever find yourself in a similar situation, I highly recommend reaching out to them.

    You can contact them through their hotline at +1(520)200-2320 (available on Phone/WhatsApp), or shoot them an email at support@thehackangels.com. They also have a great website at thehackangels.com if you prefer that route.

    If you're in London, you can even visit them in person at their office located at 45-46 Red Lion Street, London WC1R 4PF, UK. They’re super helpful and really know their stuff! Don’t hesitate to reach out if you need help!
    Image description

  • Micael Andrade
    Micael AndradeFeb 23, 2025

    Very nice!

  • Alexei Petrov
    Alexei PetrovFeb 24, 2025

    Great article! This deep dive into the Linux file hierarchy really clarifies how everything is organized. I especially appreciate the explanations of the less common directories like /proc and /sys. It's much easier to navigate and troubleshoot now. Thanks for sharing this valuable resource!

    Looking to optimize your business processes? Hire skilled Odoo programmers to customize and develop your Odoo ERP solution. They can tailor the platform to your specific workflows, integrate essential modules, and create custom functionalities. Finding the right Odoo developers is crucial for maximizing your ROI and achieving seamless operations. Elevate your business with a perfectly tailored Odoo system.

  • nadeem zia
    nadeem ziaFeb 24, 2025

    Nice one...

  • Vinh Chi
    Vinh ChiFeb 24, 2025

    Nice

  • Dionisio
    DionisioFeb 27, 2025

    Thank you. I learned something here!

    • VanessaMartin
      VanessaMartinFeb 28, 2025

      I­'m­ m­a­k­i­n­g­ o­v­e­r­ $20k­ a­ m­o­n­t­h­ w­o­r­k­i­n­g­ p­a­r­t­ t­i­m­e­. i­ k­e­p­t­ h­e­a­r­i­n­g­ o­t­h­e­r­ p­e­o­p­l­e­ t­e­l­l­ m­e­ h­o­w­ m­u­c­h­ m­o­n­e­y­ t­h­e­y­ c­a­n­ m­a­k­e­ o­n­l­i­n­e­ s­o­ i­ d­e­c­i­d­e­d­ t­o­ l­o­o­k­ i­n­t­o­ i­t­. w­e­l­l­, i­t­ w­a­s­ a­l­l­ t­r­u­e­ a­n­d­ h­a­s­ t­o­t­a­l­l­y­ c­h­a­n­g­e­d­ m­y­ l­i­f­e­. t­h­i­s­ i­s­

      w­h­a­t­ i­ d­o­..... Worksprofit1.online/

  • FengFanChen
    FengFanChenMar 3, 2025

    Thanks for your teaching. It benefits me. In your article, I quite agree with the sentence "Keep exploring, keep learning!"

Add comment