Skip to contentExploitQuest

Everything Lives in One Tree

No drive letters, no scattered folders — one hierarchy, starting from a single slash. Learn to read a path and you can never truly be lost.

3 min readNot yet reviewed
Wrenlearner

On my old computer there was a C drive and a D drive. Where are the drives here?

Rookmentor

There are none, in that sense. Everything — every disk, every device, every file — hangs inside one tree that starts at a single point. Once you see that, the whole system stops feeling like a maze.

One root, one tree

The root directoryRoot directoryThe single folder, written /, that everything else lives inside — the top of the one tree the whole system is arranged as. is written /. Everything lives inside it: your files, the programs, even the disks and devices themselves. There is no "other drive" — there is one tree, and every pathPathThe address of a file or folder in the system's single tree — the sequence of folders to reach it, separated by slashes. is just directions through it from some starting point.

/
|-- home/
|   |-- wren/         <- your home; the shell starts you here, shown as ~
|       |-- notes.txt
|-- etc/              <- system configuration lives here
|-- usr/              <- installed programs
|-- tmp/              <- scratch space, cleared on reboot
  1. Line 1The single slash is the top. Everything is somewhere below it — this is the whole organising idea.
  2. Line 3Your home directory is your own corner. The shorthand ~ always means it, wherever you are.
  3. Line 5You will meet /etc constantly: it is where a Unix system keeps its settings, as plain editable text files.

Absolute versus relative

An absolute path starts from / and spells out the whole way down: /home/wren/notes.txt. A relative path starts from wherever you are now: if you are in /home/wren, then just notes.txt means the same file. Same destination, different starting point.

Moving around, and never being lost
# where am I?
$ pwd
/home/wren
# go into a folder (relative to here)
$ cd Documents
$ pwd
/home/wren/Documents
# ".." means the folder above. go back up one.
$ cd ..
/home/wren
# lost? "cd" with nothing always returns home.
$ cd
$ pwd
/home/wren

You are somewhere deep in the tree, confused about where, and want to get back to safety. What is the one command that always works?

You are in /home/wren/Documents and run `cd ..`. Where are you now?

Feeling lost

- Guessing where you are
- Typing long paths by hand and mistyping them
- Not knowing how to get back

Always oriented

- pwd to ask "where am I", any time
- Tab completion so paths are never mistyped
- cd with no argument to jump home instantly
- Reading a path as directions, not memorising the map

You do not learn the filesystem by memorising it. You learn two questions — where am I, and how do I go up or home — and the tree takes care of itself.

Wrenlearner

So there is no maze. There is one tree and two questions.

Rookmentor

That is the whole navigation lesson. Where am I, and how do I move relative to here. Everything else is just names of folders.

Try it without the terminal

Fill in the two commands you actually need. The first prints where you are; the second takes you home from anywhere.

then
Show the answerpwd then cd

Each of these is a path. Sort them by whether they start from the root or from wherever you happen to be standing.

  • notes.txt
  • /
  • /home/wren
  • ../logs
  • /etc/hosts
  • ./run.sh
Show the answer
  • Absolute — starts at //home/wren, /etc/hosts, /
  • Relative — starts from here../logs, notes.txt, ./run.sh

So the system is one tree from a single /, a path is directions through it, and you are never lost with pwd and cd. Next, we stop just looking around and start doing: creating, reading, copying and — carefully — deleting the files themselves.