DEV Community

Cover image for The Linux Filesystem Explained for Beginners (What Lives Where)
FlatlinerAtheist | CLI-NERDS
FlatlinerAtheist | CLI-NERDS

Posted on Originally published at clinerds.com

The Linux Filesystem Explained for Beginners (What Lives Where)

Coming from Windows, the Linux filesystem looks alien at first: no drive letters, no C:\, and a bunch of directories with cryptic three-letter names. But there's a simple logic to it — everything hangs off one root directory called /, and each top-level folder has a specific job.

Once you learn what lives where, navigating Linux stops feeling random.

One tree, one root

Windows gives every drive a letter. Linux mounts every disk, USB stick, and network share into a single tree starting at / (the root directory). Your second hard drive isn't D: — it might appear at /mnt/data. Your USB stick shows up somewhere like /media/yourname/usb.

This is called the Filesystem Hierarchy Standard (FHS), and almost every distro follows it.

The directories you'll actually use

  • /home — your personal files. Each user gets /home/username (often written ~). This is your Documents, Downloads, and config files. Back this up and you've saved what matters.
  • /etc — system-wide configuration files. Nginx configs, network settings, user accounts (/etc/passwd). Text files, editable, and the reason Linux servers are so scriptable.
  • /var — data that changes constantly: logs (/var/log), databases, website content, package caches. When a server disk fills up, /var/log is a prime suspect.
  • /root — the root user's home directory. Not the same as /. Regular users can't enter it.
  • /usr — installed programs and libraries (/usr/bin, /usr/lib). You rarely edit anything here; the package manager owns it.
  • /bin and /sbin — essential commands. On modern distros these are just symlinks into /usr/bin and /usr/sbin.
  • /tmp — temporary files, wiped on reboot. Never store anything you care about here.
  • /boot — the kernel and bootloader files. Small, important, leave it alone.
  • /dev — devices represented as files: /dev/sda is a disk, /dev/null swallows output. The Unix "everything is a file" philosophy, literally.
  • /proc and /sys — virtual windows into the running kernel. /proc/cpuinfo shows your CPU details; nothing here is a real file on disk.
  • /mnt and /media — mount points for temporary (/mnt) and removable (/media) storage.

Permissions in 30 seconds

Every file has an owner, a group, and permission bits for read/write/execute. ls -l shows them:

-rw-r--r-- 1 user user 4096 Nov 2 notes.txt
Enter fullscreen mode Exit fullscreen mode

The first ten characters are the type and permissions; our chmod calculator translates the numbers (644, 755) into plain English if the letters confuse you.

Paths: absolute vs relative

An absolute path starts at the root: /home/user/notes.txt. A relative path starts from wherever you are: documents/notes.txt. Two shortcuts you'll type daily:

  • .. — the directory above the current one (cd .. goes up)
  • ~ — your home directory (cd ~/Downloads works from anywhere)

Try it yourself

ls /            # the whole top-level map
df -h           # which disks are mounted where, and how full they are
du -sh /var/log # how much space a directory uses
find /etc -name "*.conf" | head   # config files in the wild
Enter fullscreen mode Exit fullscreen mode

Spend ten minutes clicking through /etc, /var/log, and your home directory, and the layout will stick for life. For the next step, our guides on file permissions and the find command build directly on this map.

Top comments (0)