DEV Community

Cover image for 🔍 Linux Directories Explained: Where Everything Lives in Your System 🖥️
DevOps Descent
DevOps Descent

Posted on

🔍 Linux Directories Explained: Where Everything Lives in Your System 🖥️

💡 Ever wondered what’s inside Linux directories like /etc and /home? 🌐 This simple guide makes it crystal clear—perfect for beginners!

Image description

Linux File System Hierarchy (Simplified)

Think of the Linux file system as a tree, with / (root) being the trunk and all the directories branching out from it. Here’s a quick guide to the most important "branches":

1. / (Root Directory)

  • This is the starting point of everything in Linux. All files and directories grow from here.

Image description


2. /home (Your Personal Space)

  • This is where all user files are stored.
  • Each user gets a folder, like /home/descent or /home/devops.
  • It’s like your personal “Documents” folder on Windows or macOS.

3. /etc (Settings and Configs)

  • This is where Linux stores configuration files for your system.
  • Imagine it as a control center for how things should work.
    • Example: Network settings, user info, and service configurations.

Image description


4. /var (Variable Data)

  • This directory is for files that change often.
  • Think of it as a logbook or a diary for your system:
    • Logs (/var/log) – Records of what’s happening.
    • Temporary emails, cache, and print jobs.

5. /bin (Basic Programs)

  • Contains essential programs needed to make the system work.
    • Example: Commands like ls, cp, and mv.

6. /usr (User Programs)

  • Holds programs and files that you install, like games or editors.
  • It’s like the "Program Files" folder on Windows.

7. /tmp (Temporary Files)

  • A place for temporary files that don’t stick around for long.
  • Files here are deleted when you restart your system.

8. /dev (Devices)

  • Where Linux manages devices like your hard drive, USB sticks, or printers.
  • These are treated as files in Linux.

9. /proc and /sys (System Info)

  • Special directories that provide real-time info about your system.
    • /proc: Info about running processes.
    • /sys: Info about your hardware.

10. /boot (Startup Files)

  • Contains files needed to boot (start) the operating system.
  • Don’t mess with this unless you know what you’re doing!

Image description


11. /opt (Optional Software)

  • Used for third-party or optional software.
    • Example: Custom software not part of the standard system, like /opt/myapp.

12. /sbin (System Binaries)

  • Contains system programs needed for administrative tasks.
    • Examples:
    • fsck (disk check).
    • reboot (restart the system).
    • iptables (firewall management).

13. /media (Removable Media)

  • Used for automatically mounting external drives, USB sticks, and DVDs.
    • Example: /media/username/USB_DRIVE when a USB is plugged in.

14. /mnt (Mounted filesystems)

  • Used as a mount point for temporarily mounted filesystems.
    • Example: /mnt/FOLDER

Image description

Summary

  • The Linux file system organizes files neatly into specific folders, each with a clear purpose.
  • Learning these key directories helps you navigate and manage Linux like a pro!

Support if you found this helpful😉

No Money 🙅🏻‍♀️ just Subscribe to me YouTube channel.

Linktree Profile: https://linktr.ee/DevOps_Descent
GitHub: https://github.com/devopsdescent

Top comments (7)

Collapse
 
biapy profile image
Pierre-Yves Landuré

It would have been nice to complete this by linking to Filesystem Hierarchy Standard @ Wikipedia and freedesktop.org's Base Directory Specification @ Wikipedia.

/var contents (spool, run, cache, lib) are important to know about.

Collapse
 
devops_descent profile image
DevOps Descent

Thanks, I'll add those for sure🤗

Collapse
 
josephj11 profile image
Joe

Good top level coverage.
Your article covers the virtual directories (except /run), but your diagram at the top doesn't show them.

On my system (Kubuntu 22.04), there is nothing in /mnt. Everything else gets mounted in /media.

Collapse
 
ankurk91 profile image
Ankur K

The new standard is that /media is where the system mounts removable media, and /mnt is for you to mount things manually.

askubuntu.com/questions/138547/how...

Collapse
 
josephj11 profile image
Joe

Thanks. I wasn't quite clear on that. The monster flowchart in the AU post is very nice as well.

Collapse
 
kevinbarrientos profile image
Kevin Barrientos

What’s the difference between /usr and /opt?

Collapse
 
ankurk91 profile image
Ankur K

OPTional

It holds optional software and packages that you install that are not required for the system to run.