← Teacher guides

Teacher guide: The command line

For Years 8–10: use a computer by typing commands, as people do on servers, Raspberry Pis and Linux and Mac computers. Move around folders, read and search files, change them, chain commands with pipes, and control who can read what. Everything runs on a pretend computer in the browser; a Raspberry Pi is the real thing.

Open the student course · How the ideas build

Each lesson works two ways. Students can work through the online tutorial at their own pace (it checks their answers and saves their progress in their browser), or you can teach it to the whole class from the slides, then send students into the tutorial for the Modify and Make steps.

Every lesson guide has plain-language notes, the answers to every check, a solution for every task, and slides and a worksheet for Waypoints Prepare. These guide pages are not linked from student pages, but they are not secret either: keep printed Teacher editions for answers you do not want students to find.

Whole-course cheat sheet: Open to print (every command, grouped by unit: a handout for the final challenge)

Using a shell

Folders and paths, reading and finding, changing files, pipes, and permissions.

The command line in 5 minutes (read before teaching this unit)

The idea in plain words

A shell lets you use a computer by typing commands instead of clicking. Every Linux server, Raspberry Pi and Mac has one, and it is how most of the internet's computers are run.

Files live in a tree of folders. A path names a place in the tree: /home/sam/projects starts at the top (/); projects/game starts from where you are; .. means the folder above; ~ means your home folder. pwd says where you are, ls lists what's here (ls -a shows hidden names, which start with a dot), and cd moves you.

cat prints a file; grep word file prints only the lines containing the word. mkdir, cp, mv and rm make, copy, move and delete; rm is for good, with no recycle bin. A pipe (|) sends one command's output into the next, so small commands combine: grep cat pets.txt | wc -l counts matching lines. > saves output into a file.

Every file has an owner and permissions: read, write and run (r, w, x) for the owner and for everyone else. ls -l shows them (-rw-r--r-- is 644: you can read and change it, everyone else can only read it). Only the owner can chmod them, and hiding a file (a dot name) protects nothing.

Where to run it for real

The board is a pretend computer, the same everywhere. For the real thing, in order of preference: a Raspberry Pi; an in-browser Linux such as WebVM (no install; test it on the school network first); Mac Terminal (zsh: almost the same commands); WSL on Windows or VirtualBox (both need admin rights to install).

What students get wrong

  • cd moves files. It moves you.
  • If ls doesn't show it, it isn't there. Hidden names need ls -a.
  • Deleted files go to a recycle bin. Not with rm.
  • Each command only reads files. After a pipe, it reads the previous command's output.
  • Hidden means protected. Only permissions protect a file.

The words

shell, command, folder, path, home folder, hidden file, pipe, permissions, owner, read, write, run.

Cheat sheet: Open to print (A4, with board pictures) · Open in Print · Markdown

Project briefs

Printable task sheets for assessment or extension: students make something, hand it in and explain their choices. The success criteria are the curriculum nodes' own. Open the briefs page

Teach the command line (after permissions)

Make a one-page guide or a short screen recording that teaches a Year 7 student the command line, using the pretend terminal from the lessons to show your examples.

It should show how to find and read files, how a pipe joins small commands, and how file permissions decide who may do what. It should also explain what the operating system is doing in all this.

Hand in:

  • Your guide or recording, with three commands, each with what it does and an example of it working.
  • One pipe of at least two commands, with what each part does and what comes out.
  • A permission string such as rw-r--r-- decoded in plain words, and one example of how it stops something from happening.
  • A short explanation of what the operating system does here, and how that is different from signing in.

Evidences:

  • The OS as a hardware abstraction layer (AC9TDI10K01 node 1): Correctly describes the OS as sitting between hardware and applications; Uses a specific example to illustrate how abstraction works (e.g. mouse and touchscreen treated the same by an application)
  • Access control mechanisms (AC9TDI10K01 node 3): Distinguishes authentication from authorisation/permissions correctly; Explains what a specific access control mechanism protects against in a networked context

The point is that the operating system sits between programs and hardware: the same small program works whether its input is the keyboard, a file or another program's output, because the operating system joins them. Strong guides say so in words a younger student could follow, rather than listing commands. For permissions, check that the example really shows the file being refused or allowed (a student who can read but not change a file). The last item separates proving who you are (signing in) from what you may do once you have (permissions): a distinction Access control and Who can read what both teach.