The Linux Directory Structure, Explained

Run ls / on any Linux machine and you'll see the same two dozen directories — a layout standardized as the Filesystem Hierarchy Standard (FHS). Once you know what each one is for, an unfamiliar server stops being a maze: configs are always in one place, logs in another, and "where would that be?" answers itself.

One tree, everything included

Unlike Windows with its drive letters, Linux has a single tree rooted at /. Disks, USB sticks and network shares don't get letters — they're mounted onto directories inside the tree. Even hardware and kernel state appear as files. "Everything is a file" is the founding design decision, and the directory layout is its map.

//etcconfigs/homeusers/varlogs, data/usrprograms/tmpscratchnginx/user/log/www/bin/one tree for everything — disks and devices are mounted onto directories, not letteredabsolute paths start at / ; relative paths start where you stand
The single tree: every path in the system hangs from /.

The directories you'll actually visit

DirectoryWhat lives there
/homeOne personal directory per user (/home/diego). Your files, your dotfiles, your mess. ~ expands to yours.
/etcSystem-wide configuration, as editable text files: /etc/nginx/, /etc/ssh/sshd_config, /etc/hosts, /etc/crontab. When you need to configure anything, start here.
/varVariable data — things that grow: logs (/var/log), databases (/var/lib), mail queues, website roots (/var/www). When a disk fills up, the culprit is usually somewhere in /var.
/usrInstalled programs and their support files. /usr/bin holds most commands you run; /usr/share their data; /usr/local is for software you install manually, outside the package manager.
/tmpScratch space for anyone and anything. Assume it's wiped on reboot — never store something you want to keep.
/optOptional, self-contained third-party applications — commercial software and things that ship as "one big directory" often land in /opt/appname.
/rootThe administrator's home directory. Not /home/root — it lives apart so root can log in even if /home fails to mount.
/bin, /sbin, /libEssential commands and libraries. On modern distros these are symlinks into /usr — historical layers made compatible.

The special ones: windows into the kernel

DirectoryWhat it really is
/procNot a real disk directory — a live view of the kernel. /proc/cpuinfo describes your CPU, /proc/meminfo your memory, and each running process has a numbered directory (/proc/1234/) that tools like ps read.
/sysThe device and driver view: kernel objects exposed as a file tree. Mostly for tools, occasionally for tuning.
/devDevices as files: /dev/sda is your first disk, /dev/null the famous black hole, /dev/urandom a randomness tap. Writing to a device file writes to the device.
/mnt, /mediaConventional mount points: /media for auto-mounted USB drives, /mnt for manual/temporary mounts.
/bootThe kernel itself and the bootloader. Small, critical, and the one place where "cleaning up old files" requires real care.

Where to look when something breaks

Three rules of thumb

Configs are text in /etc — editable, diffable, versionable; back them up before editing (cp file file.bak, see cp). Anything that grows lives in /var — plan disk space there. Your experiments belong in /home, /tmp or /opt — the package manager owns /usr, and fighting it ends badly.

Keep going

Practice navigating with the interactive course, and see the cd, ls and find references for moving through the tree efficiently.