Module 1: The Terminal and the File System
8. Project: a treasure hunt through your machine
Description
You are going to explore your own computer and answer twelve concrete questions about it — where your home lives, what is in /etc, which is your most recent file, what an ls option you never used actually does — and you are going to turn in every answer along with the exact command that produced it, not a general impression. You are not going to create or delete a single file: everything you need to answer already exists on your machine and you already know how to use it. This is the module's last lesson, and its goal is for you to walk away trusting that you can orient yourself in any filesystem — yours, a coworker's, or a remote server's you will meet in module 5 — without anyone handing you a hand-drawn map.
This reproduces two real situations from the first year of anyone who works with computers daily. The first: they hand you a new company laptop, with a user account you did not set up, and on day one nobody is going to explain where everything lives — you find out yourself, with the same twelve kinds of question you are going to answer here. The second, more common than it sounds: someone asks you for help over a video call, you cannot see their screen, and you have to guide them to find a file on their own terminal using only words. In both cases, the skill that matters is not "knowing every command by heart," it is being able to stand in any filesystem and pull concrete information out of it using what you already know, plus the manual when something you do not know comes up.
Connection to the module: this lesson does not introduce new commands — with a single specific exception: ls's -1 option, which you are going to discover yourself by reading its manual, exactly as you practiced in lesson 5. Everything else is pwd (lesson 7), cd with absolute paths, relative paths, ~, and - (lesson 7), ls with -l, -a, -h, -t, -S, and -R (lesson 7), tree (lesson 7), the distinction between absolute and relative paths (lesson 6), the anatomy of a command (lesson 4), and the habit of reading the manual instead of guessing (lesson 5). Module 2 is going to teach you to create, copy, move, and delete files, and to filter hundreds of them with find and grep in seconds; before getting there, this lesson tests you with the read-only tools you already have, so you feel firsthand where counting and searching by hand starts to hurt.
Exploring without altering the terrain
A cartographer who arrives at new territory does not alter it to understand it: they do not move rocks, do not cut down trees, they just walk, measure, and take notes. When they are done, they have a map anyone else can follow without having set foot in the place. That is exactly this lesson's discipline: you are going to explore your own machine — territory you already know by sight, but probably never measured with precision — and you are going to note every finding along with the command that revealed it, not with "I think" or "it seems like."
The difference between "I think my home has a few hidden files" and "my home has 23 hidden files, according to ls -a ~" is the difference between an opinion and reproducible evidence. Anyone else — or you yourself, six months from now — can run the same command on the same machine and land on the same number. That reproducibility is what matters in an audit report, in a support ticket, or in the answer you give a coworker who asks "how does this look on your machine?"
Worked example
Before diving into the twelve questions, let us walk through one complete from start to finish, because it has a twist the others do not: what ls does when the target is not an ordinary folder, but a symbolic link.
The question: what does /etc contain and who owns it?
Step 1 — the owner, with what you already know:
ls -la /etc
What to expect (this output comes from a reference macOS machine; on Linux, including WSL, you are going to see something different, and I explain why below):
lrwxr-xr-x@ 1 root wheel 11 Sep 30 2024 /etc -> private/etc
Interpretation, column by column, same as in lesson 7: the first character is l, not d or - — it is a symbolic link, not an ordinary folder. The arrow -> tells you where it points: private/etc. The owner and group columns are root and wheel: on macOS, the entire system tree belongs to user root and group wheel. Notice that ls -la did not show you /etc's content, but the line describing the link itself. That happens because, when you give ls -l a symbolic link's path as a direct argument, the command describes the link, not what is on the other side of it.
Step 2 — the real content, following the link:
To get ls to walk through the link and show you what is inside, add a slash at the end of the path:
ls -la /etc/
What to expect (trimmed; on your machine the number of lines is going to be different):
total 872
drwxr-xr-x 79 root wheel 2528 Jul 20 19:27 .
drwxr-xr-x 6 root wheel 192 Jul 21 8:36 ..
-rw-r--r-- 1 root wheel 515 Sep 30 2024 afpovertcp.cfg
lrwxr-xr-x 1 root wheel 15 Sep 30 2024 aliases -> postfix/aliases
-rw-r----- 1 root wheel 16384 Jun 3 20:38 aliases.db
Interpretation: the trailing slash (/etc/ instead of /etc) tells ls "go in there," not "describe this path to me." It is the same distinction between path-as-destination and path-as-description you saw in lesson 6, applied to a case where there is also a link in the way. Now you do see real content: configuration files (.cfg), databases (.db), and even another symbolic link inside (aliases -> postfix/aliases), all owned by root:wheel.
If you are on Linux or WSL, /etc is almost always a real folder, not a link — you are going to see d in the first column of ls -la /etc, not l — and the typical owner is root:root instead of root:wheel. In that case you do not need the trailing slash: ls -la /etc already shows you the content directly, because there is no link to walk through.
The full answer you would write in your log: "/etc is owned by root (group wheel on macOS, root on Linux/WSL); it is a symbolic link to private/etc on macOS or a real folder on Linux/WSL; it contains dozens of system configuration files, all owned by root. Commands used: ls -la /etc and ls -la /etc/."
That is the level of detail expected in the eleven questions that follow: exact command, real result, interpretation in one or two sentences.
The twelve questions of the hunt
The questions are grouped into three blocks corresponding to the module's three central tools. There is no required order between blocks, but within each one it is worth going in order because every question leans a little on the previous one. None require administrator privileges (sudo); if at any point a command asks you for a password or returns Permission denied, that is a sign you strayed from the intended path — check the common mistakes table below.
Block 1 — Get your bearings with pwd and cd
Question 1. What is your home directory's absolute path?
cd ~
pwd
Write down the full path pwd returns (something like /Users/your-username on macOS or /home/your-username on Linux/WSL). That path is your reference point for the rest of the hunt.
Question 2. Starting from your home, what is the deepest directory you reach using exactly five cds?
There is no correct path: this is the real "treasure hunt" part. You choose where to explore — you can mix relative and absolute paths — but run pwd after every cd and write down all six results (the starting one and one per step). At the end, count how many slashes (/) your final path has: that number is an honest measure of how "deep" you got, beyond the feeling of it.
cd ~
pwd
cd Library
pwd
cd "Application Support"
pwd
# ...continue until you complete five cd in total
Question 3. What is the relative path from your home to /etc, using .. as needed?
Think it through before writing it, then verify it with cd:
cd ~
cd ../../etc
pwd
If pwd returns /etc (or the symbol representing /etc on your system), your relative path was correct. If it gives you No such file or directory or leaves you somewhere unexpected, your home is probably at a depth different from two levels below the root — adjust the number of .. and try again.
Question 4. After moving to /etc with an absolute path and coming back with cd -, which directory did it return you to exactly, and does it match your answer to question 1?
cd /etc
cd -
pwd
Block 2 — Inspect with ls
Before starting this block, give your home a panoramic look with lesson 7's tool:
tree -L 2 ~
(If you do not have tree installed, use the alternative you saw in that lesson.) You do not need to document this output; it is just to orient yourself before counting precisely.
Question 5. How many hidden files and folders are directly inside your home, not counting . and ..?
ls -a ~
Count at a glance how many entries start with a dot. The "not counting . and .." clause is not an arbitrary technicality: those two entries are always going to show up in any folder on the system — they represent "right here" and "one level up" — they are not files someone hid on purpose. Counting them as findings inflates your number by two too many.
Question 6. Which is the most recently modified file on your desktop?
ls -lt ~/Desktop
The t sorts most recent to oldest, so the first file listed after the total line is your answer. If your system does not have an English-named desktop folder — some systems installed in Spanish use Escritorio, and some WSL installations have neither by default — use the real folder you find with ls -a ~, or your Documents folder as an alternative.
Question 7. What does /etc contain and who owns it? (You already solved this in the worked example; here just confirm the result on your own machine and write it in your log with your own numbers.)
Question 8. Which is the largest file or folder inside your Downloads folder?
ls -lhS ~/Downloads
-S sorts largest to smallest and -h gives you that size in human-readable units (K, M, G) instead of a byte count you have to interpret by eye. If your Downloads folder is empty or does not exist, use Documents.
Block 3 — Read the manual
Question 9. According to man ls, what exactly does the -1 option do?
man ls
Look for the -1 entry (inside less, which is what man opens, type /-1 and press Enter to jump straight there, just as you saw in lesson 5). You are going to find something like: "(The numeric digit 'one'.) Force output to be one entry per line." Try it:
ls -1 ~
Compare it against a plain ls ~ with no flags: the visual difference — one column versus several — is proof that you understood what the manual says correctly.
Question 10. According to man ls, what is the difference between sorting with -t and with -S?
You already used both in questions 6 and 8; now go to the manual and confirm in your own words which criterion each one uses to decide the order (one sorts by modification date, the other by size in bytes) and in which direction each one does it (is the first item in the list the most recent or the oldest? the largest or the smallest?).
Question 11. cd does not have its own manual page like ls — it is part of the shell, not a separate program, as you saw in lesson 5. How do you check its help in your shell, and what does it tell you about the - argument?
help cd
(In zsh, if help cd does not work, try man zshbuiltins and search for the cd entry with /cd inside less.) Confirm in your own words what cd - does — it should match what you already observed answering question 4.
Question 12. Using tldr ls (or man ls if you do not have tldr installed), what example does it give for combining human-readable sizes with long format in a single command?
tldr ls
Look for the example that combines -l with -h (the same pair of flags you used in question 8, now confirmed from a source other than man). If you do not have tldr installed, lesson 5 already showed you how to get it or what alternative to use.
The log: your deliverable
This lesson's real deliverable is not the terminal, it is the document you write afterward. Open it with the editor you saw in this module's lesson 5, or with whichever you prefer, and fill it in with your twelve answers following the same pattern as the worked example: question, command, result, interpretation in one sentence.
# Treasure hunt — my machine
## 1. My home's absolute path
Command: cd ~ && pwd
Result: /Users/my-username
Interpretation: this is the starting point for the rest of the hunt.
## 2. Deepest directory in five cd
Command: (list of cd and pwd, one by one)
Result: /Users/my-username/Library/Application Support/...
Interpretation: 6 levels deep counting the slashes.
## 3. Relative path to /etc
...
Repeat the pattern for all twelve. A document with twelve short, verifiable entries is worth more than one long paragraph of general impressions.
Self-assessment checklist
Before considering the lesson closed, confirm each of these points:
- My log has twelve entries, one per question, and none of them was left blank.
- Every entry has a command, a result, and an interpretation — not just a loose number or name.
- I did not use
sudoin any command in this lesson. - I did not create, move, or delete any real file or folder (the only commands I ran were
pwd,cd,ls,man,help, andtldr). - In question 5, my hidden-file count does not include
.or... - In question 2, I wrote down
pwd's output after everycd, not just the last one. - I can explain in my own words the difference between
-tand-Swithout opening the manual again. - If my system did not have
DesktoporDownloadsunder that exact name, I used the real name I found withls -a ~.
Common mistakes
| What happens | Why it happens | How you spot it | How you fix it |
|---|---|---|---|
| You counted two "extra" hidden files in question 5, compared to what you expected. | You mixed up . and .. — the entries representing "this folder" and "the folder above" — with real hidden files. It is a conceptual misunderstanding: ls -a always shows them in any folder on the system, they are not a finding from your particular setup. | Run ls -a in two completely different folders: . and .. are going to show up in both, identical in name. A real hidden file, like .bash_profile, only shows up where it actually exists. | Subtract two from your count, or filter at a glance by discarding those two entries before counting. |
cd: no such file or directory: Desktop (or Downloads). | Your system has those folders under a translated name — Escritorio, Descargas — because the operating system was installed in Spanish, or they simply do not exist because you are on a minimal Linux or WSL install. | Run ls -a ~ and look at the real names of your home's folders; the English name from a tutorial is no guarantee it exists on your machine. | Use the name you actually see listed. If no variant exists, use Documents/Documentos or your own home as an alternative — already flagged in questions 6 and 8. |
While exploring the five cds in question 2, you get Permission denied and the terminal does not move. | You tried to enter a system folder your user does not have execute permission for (the permission that enables "entering," different from "reading," though module 4 goes deeper into that). It typically happens while poking around /root, /private/var/db, or similar paths reserved for the administrator. | The message itself is the tell: Permission denied on a cd, not on an ls, almost always means a restricted folder, not a typo in the name. | Do not force it with sudo — this lesson is read-only and privilege-free. Back up with cd .. and pick another branch of the tree to complete your five steps. |
Exercises
These four exercises use fixed data, not your machine, so you can check your answer against an exact solution.
Exercise 1: counting hidden files without falling into the trap
A coworker runs ls -a in a folder and gets this output:
.
..
.env
.gitignore
config.yaml
README.md
.cache
They say: "there are five hidden files." Are they right?
See solution
No. There are three real hidden files: .env, .gitignore, and .cache. The entries . and .. are not hidden files someone created on purpose: they represent "this folder" and "the folder above," and they show up in -a's output in absolutely any directory on the system. Counting them as findings is the same conceptual mistake from the table above.
Why it works: filtering out . and .. before counting is the only way for the number to reflect real project files, not structural artifacts present in every folder.
Exercise 2: relative path between two points
You are standing in /home/ana/projects/site/src and need to reach /home/ana/docs using a relative path (without typing the full absolute path). What command do you use?
See solution
cd ../../../docs
Why it works: from src you need to go up three levels to reach ana (src → site → projects → ana), and from there go down into docs. Each .. goes up exactly one level in the tree; counting the levels of difference between origin and destination, instead of guessing how many .. to put, is the technique that prevents incorrect relative paths.
Exercise 3: reading a real manual excerpt
This is a real excerpt from ls's manual:
-S Sort by size (largest file first) before sorting the
operands in lexicographical order.
According to this excerpt, if you run ls -S in a folder with files a.txt (10 bytes), b.txt (500 bytes), and c.txt (50 bytes), in what order are they going to appear?
See solution
b.txt, c.txt, a.txt — largest to smallest (500, 50, 10 bytes).
Why it works: the excerpt explicitly says "largest file first"; -S does not sort alphabetically or by date, it sorts exclusively by size in bytes, largest to smallest.
Exercise 4: reconstructing the destination of a cd chain
Starting from /var/www, someone runs this sequence, one line at a time:
cd html
cd ../logs
cd ..
cd -
Which directory do they end up standing in, after the last command?
See solution
/var/www/logs.
Why it works: step by step: cd html → /var/www/html. cd ../logs → go up one (/var/www) and down into logs → /var/www/logs. cd .. → go up one → /var/www. cd - returns to the directory before that last cd, that is, /var/www/logs — not to the first one in the whole chain. cd - always points to the immediately previous directory, not a full history.
Summary and next step
Before moving on you should be able to:
- Answer any question about "where is this" or "who owns that" on a filesystem you do not know, combining
pwd,cd, andlswith their flags. - Tell apart a path as a destination (
/etc) from a path as "go in and show me the content" (/etc/), especially when there is a symbolic link in the way. - Learn the behavior of a command option you have never used — like
-1— by reading its manual instead of looking for a tutorial that explains it to you. - Deliver every finding with reproducible evidence: exact command plus real result, never a loose impression.
You also ran, firsthand, into the limit of what you can do with this module's tools. You counted hidden files at a glance because you had no way to count them automatically. You scanned ls -lt top to bottom to find the most recent file, instead of asking the machine to hand you directly "the first one." That manual effort is not a flaw in this lesson: it is exactly module 2's motivation, where you are going to learn to create, copy, move, and delete files safely, to read entire files with cat, less, head, and tail, and above all to get find and grep to do for you, in a single line, exactly the kind of counting and searching you did by eye today.
Resources
- ls(1) — Linux man page — full reference for
ls's flags (GNU/Linux) used in this lesson, including-1. - ls(1) — FreeBSD/macOS man page — the BSD variant of
lsthat macOS uses, with the exact detail of-tand-Scited in the worked example. - GNU Bash Reference Manual — Bourne Shell Builtins — documents
cdas a shell builtin (not a separate program), includingcd -'s behavior. - Filesystem Hierarchy Standard 3.0 — specifies what
/etcmust contain and why it belongs torooton any Unix-like system. - tldr pages — the project behind
tldr, with curated per-command examples that complement the traditional manual. - Software Carpentry — The Unix Shell: Navigating Files and Directories — additional exercises combining
pwd,cd, andls, if you want to keep practicing on your own.