Phase 3. Lesson 2 of 7. About 20 minutes.
Plain entry
Windows has C:, D:, and so on. Linux has one tree that starts at /, the root, and everything hangs off it: your files, the settings, the programs, even other disks. Once you know what the main folders are for, you can find anything on any Linux machine.
Terms
- Root directory (
/): the top of the tree. Not the same as the root userThe administrator account on Linux and other Unix-like systems, with user ID 0 and unrestricted access to every file, process, and setting. Read more →. - Path: directions to a file. Absolute paths start with
/(/etc/hostname). Relative paths start from where you are (notes/todo.md). ~: your home directory..is here...is one level up.- Mount: attaching a disk or partitionA defined section of a physical disk that the operating system treats as a separate unit, each usually holding its own filesystem. Read more → to a folder in the tree.
- FHSFilesystem Hierarchy Standard: the standard that defines what goes where in a Linux directory tree, such as /etc for configuration and /var for logs. Read more →: the Filesystem Hierarchy Standard that says what goes where.
Depth
| Folder | What lives there | You will touch it when |
|---|---|---|
/etc | System configuration, plain text | Changing any setting |
/home | Users’ personal folders | Every day |
/root | Root user’s home | Rarely |
/var | Data that changes: logs, caches, databases, websites | Reading logs in /var/log |
/tmp | Temporary files, cleared at boot | Scratch work |
/usr | Installed programs and libraries | Rarely edit by hand |
/bin, /sbin | Essential commands (links into /usr on Ubuntu) | Never edit |
/boot | KernelThe core of an operating system that runs with full hardware control and decides how every program gets CPU time, memory, and device access. Read more → and bootloaderThe small program the firmware starts first, whose only job is to find the operating system kernel, load it into memory, and hand over control. Read more → | Phase 4 |
/dev | Devices as files (/dev/sda) | Disks |
/proc, /sys | Live kernel info, not on disk | Phase 2 |
/mnt, /media | Where extra disks get mounted | USB drives |
ls /
cat /etc/hostname
ls /var/log | head
Expected output (first command):
bin boot dev etc home lib lib64 media mnt opt proc root run sbin snap srv sys tmp usr var
Going further
ls -l /bin shows /bin -> usr/bin: on modern Ubuntu, /bin is a link (the “usr merge”). findmnt shows every mount in the tree, including the virtual ones.
Why it works this way
Linux puts things where they are by what kind of data they are, not by which program owns them. Settings go in /etc so you can back up one folder and keep every setting. Changing data goes in /var so it can live on a bigger disk. That is also how you troubleshoot: a broken setting means look in /etc, a full disk often means look in /var, and a missing command means look at your PATH and /usr/bin.
Self-check
- Where do you look for system settings? For logs?
- Is
notes/todo.mdabsolute or relative? - What does
cd ..do?
Answers: (1) /etc; /var/log. (2) Relative. (3) Moves up one folder.