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).
Open these in Waypoints Prepare with one click. To share a file another way, copy its address and paste it into Load URL, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.
WorksheetOpen in PrintDownload Print the student copy; the Teacher edition has the answers.
Students will be able to
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.
Timing
Predict and Try 8 min · Worked example 10 min · Vary 10 min · Practise and Make 12 min
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.
In class
On the slides at these points. Students can do the whole lesson on their own; these are for the room. In the deck, the Run, Modify and Make slides have the live playground in them (the tutorial link is the backup), and the notes above are in each slide's speaker notes.
Think, pair, share(start) How does a computer know where a file is?
What would a full address look like?
What does 'where I am' mean?
Folder tree, full paths and the idea of a current folder.
Walk the tree(predict, 5 min)
Draw a folder tree on the board. A student moves a marker as the class calls out cd steps, then says the full path to where it stopped.
Full paths start from the top. Mark where relative paths begin.
Two ways to say it(modify, 3 min)
Give the path to the same file twice: from the top, and from where you are.
They name the same file. Which is shorter depends on where you are.
Where am I?(investigate) You are in /home/sam and type cd projects. What does pwd show? /home/sam/projects cd moved you into the folder inside where you were.
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
What you will see
A question to ask
The fix
A student thinks cd moved their files (Sam's mistake).
Go back with cd .. and ls. Is notes.txt still there?
cd moves you; files stay put.
A student gets "No such folder".
Is that folder inside the one you're in? Check with ls.
Use the right short path, or a full path from /.
Answers to the checks
where will you be?: You are in /home/sam. You type cd projects, then pwd. What does pwd show? /home/sam/projects: cd moved you into the projects folder inside where you were, and pwd prints the full path.
Try: find your way: Get to the game folder. Type ls to look around and cd to move; the tree shows where you are.
cd projects, then cd game (or cd projects/game in one go). The prompt and the tree both show where you are.
Three ways to name one folder: You are in /home/sam/projects/game. You type cd ../.. Where are you now? /home/sam Each .. goes up one folder: game → projects → sam.
Find the mistake: Sam explains what cd does. Click the line where it first goes wrong. line 3 Line 3: cd moves you, not your files. notes.txt stays in /home/sam; mv is the command that moves files.
Which command?: Which command lists what is in the folder you are in? ls ls lists files and folders (folders end with /).
A full path: Go to the folder /etc with one cd, using a full path.
cd /etc: a full path starts with / and works from anywhere.
Up with ..: You start in projects/game. Get to the photos folder using ..
cd ../../photos: up to projects, up to sam, then down into photos.
Home: You start in /etc. Get home with the shortest command you can.
cd on its own (or cd ~) always goes home.
Full paths: Which path works from any folder? /home/sam/photos Paths that start with / start from the top.
The prompt: The prompt says sam@school:~/projects$. Where are you? /home/sam/projects ~ means /home/sam, so ~/projects is /home/sam/projects.
Review: the OS: Review: the same ls command works on an SSD, a USB stick or a network drive. Why? The operating system hides the difference ls just asks the operating system for the folder. Commands ask the operating system, which uses the right driver for each kind of storage.
find and read a file: There's a file called level1.txt somewhere in your home folder. Find it and print it with cat.
You found it by looking (ls) and moving (cd), then read it (cat): the three moves of every shell.
Solutions
One possible solution for each task. Other correct programs are fine.
Vary: other ways to move › A full path
Open task: any program that does what the step asks.
Vary: other ways to move › Up with ..
Open task: any program that does what the step asks.
Vary: other ways to move › Home
Open task: any program that does what the step asks.
find and read a file
Open task: any program that does what the step asks.
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).
Exit ticket
You are in /home/sam/photos. Write the command to get to /home/sam/projects in one step.
cd ../projects (or cd /home/sam/projects, or cd ~/projects).
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.
Where it leads
Next: Reading and finding (cat, grep, hidden files).
Links: Security and privacy › What the operating system does.