Shell Scavenger Hunt

A terminal puzzle: follow clues through a folder tree with cd, ls and cat, and find the treasure hidden among decoys

CS Room originalShell1 class periodNot autograded

README.md

Shell Scavenger Hunt

A treasure is hidden somewhere in this mansion. Every room is a folder, every clue is a file, and the only way through is the terminal.

Rules

  • Terminal only. The clue files won't open in the editor, and clicking around the file list will only lead you into dead ends.
  • Read every clue carefully. The basement has decoy treasure. If you skip a step, you'll find the wrong answer.

Start

Right-click this lesson's folder in the file list and choose Open in terminal. Then read your first clue:

cat start.txt

Commands

CommandWhat it does
pwdShow the folder you're in
lsList what's in it
cd <folder>Go into a folder
cd ..Go up one folder
cat <file>Print a file
  • Tab finishes a file or folder name for you. Type cat st and press Tab.
  • Up arrow brings back your last command.
  • To copy text from the terminal, select it and press Ctrl+Shift+C (or Cmd+C on a Mac). Plain Ctrl+C stops a program instead.

Lost? pwd tells you where you are, and ls shows what's around you.

When you find the treasure, write down how many coins it holds. That number is your answer.

For teachers

Shell Scavenger Hunt

A terminal puzzle. Students follow clue files through a folder tree (a "mansion") using cd, ls and cat. The last stretch hides the treasure in a hidden folder among decoys, so students have to learn ls -a and ls -l and then combine them as ls -al. The answer is one number, and every wrong number points to the step a student skipped.

The clues teach every new command as it's needed, so you don't have to teach anything up front.

Time: one class period (most students finish in 25–45 minutes) Prerequisites: none

Goals

By the end, students can:

  • move around a folder tree with pwd, ls, cd and cd .., including paths like ../../kitchen
  • read files with cat
  • show hidden files with ls -a and file sizes with ls -l
  • combine flags, as in ls -al, when they need both

Before class

  • Import the lesson into your class from the Lessons page, or with New assignment → Use a lesson on the class's Assignments tab. It arrives as a draft.
  • Publish it. Each student gets their own copy in their class folder.
  • Play it through once yourself. It takes about ten minutes.

In class

  1. Ask who has used a command line before, and for what. Explain that today they'll get around a computer by typing instead of clicking. (5 min)
  2. Show how to right-click the lesson folder, choose Open in terminal, and run cat start.txt. (2 min)
  3. Students play. Circulate and answer questions about commands, but don't give away the path. (25–45 min)
  4. Debrief: ask everyone for their coin count, then use the table below. (5–10 min)

The answer

The treasure holds 4 coins, in mansion/basement/.vault/.coin-pile-c.txt. A wrong answer tells you which step a student skipped:

AnswerWhat happened
4Correct: used ls -al in the vault
2Found the hidden piles with ls -a but didn't compare sizes with ls -l
8, 11 or 15Picked a visible pile in the vault without ls -a
3, 7 or 12Never found the hidden vault and took a chest in the basement

Where students get stuck

SymptomNudge
The editor says "This file is not text"That's on purpose: each clue file has a byte that keeps it out of the editor. Back to the terminal.
No such file or directorypwd to see where they are, then ls.
Can't find the vaultAsk what the last clue said about files whose names start with a dot.
ls -l shows sizes, but the prize isn't thereThey need hidden files and sizes at once: ls -al.

Check for understanding

  • Each student's coin count.
  • Ask: what does ls -a show that ls doesn't? Why would a computer hide files at all? (Settings files like .gitignore and .bashrc.)
  • Ask: ls -a lists . and ... What are they, and where have you used .. before?

Going further

  • Find every file in the mansion that mentions coins: grep -ril coins mansion.
  • Run ls --help and find out what ls -t and ls -S do.
  • The eye icon at the top of the file list shows hidden files there too.

Standards

CSTA standards

2017 standards

  • 3A-CS-03Develop guidelines that convey systematic troubleshooting strategies that others can use to identify and fix errors.

2026 standards

  • HS-SYS-HW-29Differentiate an operating system as a special type of software that manages both the hardware and other software components of a computing system, including handling memory and peripherals.
  • HS-PRO-TR-19Evaluate a computing technology's alignment with design specifications and responsible design values, including its correctness, effectiveness, and user experience.