<aside> 2️⃣

Module 2 — The Filesystem

Everything in Linux is reached through the filesystem — configs, logs, devices, even running programs. Until you can navigate it blind, every other skill is guesswork. This module teaches the tree, the standard layout, and the six commands you will run more than all others combined.

Legend used throughout: 🧠 concept → 🧩 analogy → 🧪 exercise → ✅ expected result (hidden) → 🎯 interview questions (hidden)

</aside>

<aside> 🚦

Before you start

You need Module 1 — What Linux Is: the terminal, the prompt, command/option/argument anatomy, reading errors, and getting help with --help and man. Tools: any Ubuntu 24.04 environment (as set up in Module 1). Nothing new to install.

</aside>

<aside> ℹ️

This page uses Mermaid diagram blocks. Notion shows them as code by default — click the block and set it to Preview to see the diagram. This reminder appears once per page.

</aside>

Part A — One tree, and where you are in it

A1. Everything hangs from /

<aside> 📖

Official docs: hier(7) — description of the filesystem hierarchy · Filesystem Hierarchy Standard 3.0

</aside>

🧠 Linux stores everything in one single tree of directories (the Linux word for folders). The tree starts at a directory whose name is just /, called the root directory. Every file on the system lives somewhere under it.

A path is a file's address in that tree: the directory names you pass through, joined by /. So /var/log/syslog means: start at the root, enter var, enter log, find syslog. A path that starts with / is an absolute path — a complete address from the root, unambiguous from anywhere.

Two rules from Module 1 apply with full force here: names are case-sensitive (/tmp and /Tmp are different), and one wrong character is a different address, not a near miss.

<aside> 🧠

Counter-intuitive (especially from Windows): there are no drive letters. There is no C: and no D: — ever. A second disk, a USB stick, a network share: each gets attached to a directory inside the one tree (the verb is mounting, and Module 12 teaches it). The tree is the universe; storage devices are grafted into it, invisibly to paths.

</aside>

<aside> 🧩

Real-world analogy — the full postal address

An absolute path is a complete postal address written from the largest unit down: country, city, street, house. /var/log/syslog is "country var, city log, resident syslog". Given the full address, anyone can find it from anywhere.

Where the analogy stops working. Postal addresses tolerate fuzz — a missing postcode usually still delivers. A path is exact-match only, and there is exactly one "country": a single root, shared by everything, no matter how many physical disks the machine has.

</aside>

🧪 Exercise A1.1 — Look at the root

ls /     # ls = list a directory's contents; the argument names WHICH directory

A2. pwd and cd — where am I, and moving

<aside> 📖

Official docs: pwd(1) · Bash manual — cd is a shell builtin

</aside>

🧠 Your shell always stands somewhere in the tree. That location is the working directory, and two commands manage it: pwd (print working directory) tells you where you are; cd (change directory) moves you. Every shell has its own working directory — two open terminals can stand in two different places.

Why it matters: when you name a file without a leading /, the shell and programs look for it relative to the working directory. Where you are standing silently changes what your commands mean.

<aside> 🧩

Real-world analogy — the "you are here" marker

A mall map has a red dot: you are here. pwd reads the dot; cd moves it. All directions you give ("the shop next door") are interpreted from the dot.

Where the analogy stops working. Walking a mall takes time and passes every shop between. cd teleports — cd /var/log from anywhere is one instant hop, and nothing "between" is visited. Moving is free; knowing where you stand is the actual skill.

</aside>