Files live in a tree of folders, and a path names a place in it. pwd says where you are, ls lists what is here and cd moves you, with full paths from the top (/), short paths from where you are, .. for the folder above and ~ for home.
Most of the world's servers have no mouse and no windows. People run them by typing. Where do you even start?
A shell is a way to use a computer by typing. You type a command, press Enter, and the computer answers. This board is a pretend computer, so nothing you type can break anything.
Predict: Read the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.
Try: Try it on the board and compare the result with your prediction.
Investigate: Work out why it happens, one step at a time.
Modify: Change the problem on purpose and see what happens.
Practise: A few on your own, to check you have it.
Make: Make your own problem using what you have learned. Expect a few tries; that is normal.
Make your prediction first. Help opens once you've locked it in.
PredictRead the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.
Where will you be?
TryTry it on the board and compare the result with your prediction.
Try: find your way
Was your prediction right? Type pwd to check.
Try it yourselfYour edits are saved in this browser.
Get to the game folder. Type ls to look around and cd to move; the tree shows where you are.
Use the board. This ticks when you get there.
InvestigateWork out why it happens, one step at a time.
Worked example: reading a path
Worked exampleBefore each step, say what you think comes next.
/home/sam/projects/gameA full path starts with /, the very top, and works from anywhere.
projects/gameA short path starts from where you are now (here, /home/sam).
..The folder above. From game, .. is projects, and ../.. is sam.
∼Your home folder, /home/sam. cd on its own also goes home.
Now try two lots of ..
Sam explains what cd does. Click the line where it first goes wrong.
ModifyChange the problem on purpose and see what happens.
Vary: other ways to move
Try it yourselfYour edits are saved in this browser.
Go to the folder /etc with one cd, using a full path.
Use the board. This ticks when you get there.
You start in projects/game. Get to the photos folder using ..
Use the board. This ticks when you get there.
You start in /etc. Get home with the shortest command you can.
Use the board. This ticks when you get there.
PractiseA few on your own, to check you have it.
Paths
MakeMake your own problem using what you have learned. Expect a few tries; that is normal.
Find and read a file
Then: what's the full path of that file? Could you print it with one command from home?
Try it yourselfYour edits are saved in this browser.
Need a hint?
No tree this time: use ls to look inside each folder.
Another hint
It's somewhere inside projects.
Another hint
cd projects/game, then cat level1.txt.
There's a file called level1.txt somewhere in your home folder. Find it and print it with cat.
Use the board. This ticks when you get there.
For teachers
Students move around a pretend Linux filesystem with pwd, ls and cd, reading full paths, short paths, .. and ~, with a folder tree beside the terminal (AC9TDI10K01 node 1, the operating system's file system). About 40 minutes.
I can say where I am, list what is here, and move with cd.
I can read a full path and a short path, including .. and ~.
I can find a file by looking and moving.
Before class
Try the boards yourself. Everything runs in the browser on a pretend computer; nothing touches the school's machines.
The one idea: files live in a tree, and a path names a place in it. The folder tree is on for the Try and Vary and off for the Make, so students build the path themselves.
For the real thing (optional, after the course): a Raspberry Pi is best; WebVM runs Linux in a browser tab with no install (test it on the school network first); Mac Terminal works with the same commands; WSL or VirtualBox on Windows need admin rights.
Running the lesson
Predict: students who said /projects think cd starts from the top.
Try: ask what the prompt shows after each cd.
Worked example: model reading a path aloud: "from the top, home, sam, projects".
Vary: ask which way works from anywhere.
Make: no tree: ask how they knew where to go.
The hard part (on purpose)
The first minutes at a prompt feel like guessing. Let students type and get it wrong: the board is pretend, errors are friendly, and the tree shows where they are.
When students get stuck
A student thinks cd moved their files (Sam's mistake). Ask: Go back with cd .. and ls. Is notes.txt still there? Fix: cd moves you; files stay put.
A student gets "No such folder". Ask: Is that folder inside the one you're in? Check with ls. Fix: Use the right short path, or a full path from /.
Stretch and support
Stretch: Press Tab after typing the start of a folder name. What does it do? (It completes the name.)
Support: A card with four commands: pwd (where am I?), ls (what's here?), cd name (go in), cd .. (go up).
Where it leads
Next: Reading and finding (cat, grep, hidden files).
Links: Security and privacy › What the operating system does.
What each step is for
where will you be?: Committing to where cd takes you tests the new move: a path names a place in the folder tree, and cd moves you there.
Try: find your way: Moving through the tree with ls and cd, with the tree shown beside, settles the prediction and shows the new move.
Worked example: reading a path: Reading full and short paths, including .., models the new move. Sam thinks cd carries files along, the misconception planted after the method.
Vary: other ways to move: Each task changes one thing about the path: a full path from the top, going up with .., then cd on its own to go home.
paths: Reading paths without the board is the same move in mixed forms, plus a review of what the operating system does.
find and read a file: Finding a file with no tree to look at reverses the process: students build the path themselves from ls.
Now you can
Say where I am, list what is here, and move with cd.
Read a full path and a short path, including .. and ~.