Skip to content

Linux Filesystem Hierarchy Explained for Beginners

Learn the Linux Filesystem Hierarchy with examples. Understand root, bin, etc, home, var, tmp, and more. A complete beginner’s guide to Linux directories and essential commands for system administration.

Dasun Kalupahana 2 min read 865 views 0 comments

If you want to become an expert in Linux or work confidently in the IT industry, one of the first things you must understand is the Linux Filesystem Hierarchy.

Every single file, folder, configuration, log, or application in a Linux system is organized under a well-defined directory structure. Without knowing what each directory represents, working on Linux is like walking blindfolded.

In this article, we’ll explain the Linux Filesystem Hierarchy, what each folder means, and how to navigate it effectively.


📂 Linux Filesystem Hierarchy Explained

Here’s a breakdown of the most important Linux directories:

1./ (Root Directory)

The top-level directory of the entire Linux filesystem. Every other folder and file is stored inside this.
Examples: /home, /etc


2. /bin (Binary)

Contains essential user commands (executables) required for basic system operations.

Examples: cat, ls, cp, mv


3. /sbin (System Binary)

Holds system administration commands used by the root or sudo users.

Examples: fdisk, reboot


4. /etc (Configuration Files)

Stores system-wide configuration files for the OS and installed services.

  • /etc/passwd → User accounts
  • /etc/apt/sources.list → Ubuntu repositories

5. /dev (Devices)

Represents hardware devices as files.

  • /dev/sda → Storage device
  • /dev/tty → Terminal

6. /proc (Process Information)

A virtual filesystem with information about running processes and kernel parameters.

  • /proc/meminfo → Memory usage
  • /proc/cpuinfo → CPU details

7. /var (Variable Files)

Contains frequently changing data like logs, caches, and databases.

  • /var/log → System logs
  • /var/www/html → Web server files

8. /usr (User Programs)

Contains user-installed applications and utilities.

  • /usr/bin → User binaries
  • /usr/lib → Libraries

9. /tmp (Temporary Files)

Stores temporary files that are usually deleted after a reboot.


10. /home (User Directories)

Personal directories for each user in the system.
Example: /home/username


11. /boot (Boot Files)

Contains boot loader files needed to start the OS.

Examples: grub/


12. /lib (Libraries)

Holds essential shared libraries for /bin and /sbin.


13. /opt (Optional Software)

Used for third-party or optional software installations.


14. /mnt (Mount Point)

Temporary mount point for external or network file systems.

Examples: /mnt/usb, NFS mounts


15. /media (Removable Media)

Auto-mounts removable devices such as USBs and CDs.


16. /srv (Service Data)

Stores server-related data for services like FTP or websites.


17. /run (Runtime Data)

Holds runtime process data for the current session.

 

🖥️ Essential Linux Commands for Navigating the Filesystem

Now that you understand the structure, let’s look at some basic Linux commands to work with the filesystem.

  • pwd → Print current working directory
  • cd → Change directory
  • ls → List files/folders
  • mkdir → Create a new directory
  • touch → Create an empty file
  • cp → Copy files/folders
  • mv → Move or rename files/folders
  • rm → Remove files/folders
  • rmdir → Remove an empty directory
  • cat → Display file content
  • less / more → View file content page-by-page
  • vi / vim → Edit files in a text editor
  • df → Show disk space usage
  • du → Check directory size
 
Conclusion

The Linux Filesystem Hierarchy is the foundation of every Linux-based operating system. By understanding what each directory does, you’ll be able to navigate Linux with confidence, manage servers, troubleshoot issues, and work like a true IT professional.

👉 Start practicing these commands today and explore the filesystem to become more comfortable with Linux.

If you found this helpful, feel free to share or drop a comment. Happy coding with Laravel! 🧱✨

 

Free resources for this topic

Code snippets and fixes for this topic

Get one practical tip every week

New tutorials, fixes and free cheat sheets from DEV Talk, straight to your inbox. No spam, unsubscribe in one click.

Free download: Docker cheat sheet (PDF)

Have a question about this post?

Ask the community: other developers and the author can answer.

Ask the community

Get notified about new articles

One click, no email needed. Turn it off anytime with the bell at the top.

Get new articles on your iPhone

Add DEV Talk to your Home Screen, open it, then tap the bell.

Rate this post
0.0
Share

Enjoying the content?

If this article helped you, you can support the author with a coffee. It keeps new posts coming.

Buy me a coffee (opens in a new tab)

Comments 0

Be kind. Comments with links are reviewed before they appear.

No comments yet

Be the first to share your thoughts.

Get new articles in your inbox

Practical tutorials and deep dives, about once a week. No spam, unsubscribe anytime.

Privacy policy

Add DEV Talk to your Home Screen

  1. 1 Tap the Share button in Safari's toolbar.
  2. 2 Scroll down and tap Add to Home Screen.
  3. 3 Tap Add. Open it from the Home Screen to read like an app and to turn on notifications with the bell.

We use cookies to improve your experience and analyze traffic. By continuing, you agree to our Privacy Policy.