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 (5)

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
 
Sloan, the sloth mascot
Comment deleted
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?