DEV Community

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

Posted on

7 2 2 2 2

🔍 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

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (7)

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.

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay