Module 1: Linux setup & CLI#
You will:
- Build
~/bridge-lab, your workspace for all four modules. - Read, copy and move files.
- Write and run a Bash script.
New to terminals? Complete 1.1: Setup first, then return to the game.
Practice roadmap#
Start in the browser. Build confidence. Then try a real shell challenge.
- Level 01 · Do
CMD Challenge ↗
Try the first few Unix command challenges in the browser.
- Level 02 · Decode
ExplainShell ↗
Paste a command and inspect what its arguments mean.
- Level 03 · Learn
Linux Journey ↗
Read the Command Line and Permissions lessons.
- Level 04 · Play
Bandit ↗
Use SSH after setup. Start with levels 0–3 in the game mission below.
Game mission: BanditRead a file. Unlock the next level. | 3 challenges
Start here#
- Game: Bandit gives you a remote Linux computer.
- Flow: each password unlocks the next account.
- Goal: reach
bandit3.
Open your Ubuntu/WSL or macOS terminal. Check
ssh -V.Connect to the official game host:
ssh -p 2220 [email protected]On a first connection, check the hostname before accepting SSH’s host-key prompt.
Enter the published starter password:
bandit0. Password input is invisible.Check the prompt:
bandit0means you are on the remote computer.After
exit, you are back on your computer.
Challenge 1: Read the ordinary file (0 to 1)#
- Run
ls. - Choose a filename that looks useful.
- Try reading it before opening the walkthrough.
Walkthrough: list, read, reconnect
On Bandit, run these separately:
ls
cat readme- Copy the printed password into private notes outside
bridge-lab. - Exit and reconnect:
exit
ssh -p 2220 [email protected]- Enter the password you found, not
bandit1. - Check: your new prompt names
bandit1.
Challenge 2: Read a file called - (1 to 2)#
- Run
lsand find the file named-. - Predict how to identify that file explicitly.
- If
cat -waits for keyboard input, press Ctrl+C.
Walkthrough: give cat a path
- Run
cat ./-below and save the password before exiting. - Run the remaining commands one at a time.
cat ./-
exit
ssh -p 2220 [email protected]- Use the saved password at the next login.
- Check: your prompt names
bandit2.
- Why
./-? It explicitly identifies the file named-in this directory.
Challenge 3: Read a name containing spaces (2 to 3)#
- Run
ls. - Copy the filename exactly, including its spaces.
Walkthrough: quote the whole path
- Run the first command and save the password.
- Exit and reconnect with the remaining commands.
cat "./--spaces in this filename--"
exit
ssh -p 2220 [email protected]- Enter the newly found password.
- Check: your prompt names
bandit3. - Run
exitto return home.
- Quotes: keep the filename’s spaces together.
./: handles the leading dash.
Stuck?
- Check the account number, password and port
2220. - Filename differs? Use
lsand the official level instructions. - Connection times out? Your network may block that port.
Keep the skill:
- Record what
ls,cat,./and quotes did innotes/shell.txt. - Keep passwords out of that file.
- Try the next level using
ls -labefore looking up a solution.
Your lab#
- Open the sections in order.
- Predict, then run commands one at a time.
- Change one thing and compare the result.
1.1 · Open a terminal and install tools
- Terminal: the window where you enter commands.
- Shell: the program that interprets them.
- Ubuntu: usually uses Bash.
- macOS: usually uses zsh; these navigation commands work in both shells.
Choose your system#
Windows
- If Ubuntu/WSL is already installed, open it; skip installation.
- Otherwise, open PowerShell as Administrator and run
wsl --install -d Ubuntu. - Restart if prompted, then open Ubuntu from Start.
- Create a Linux username and password; password input is invisible.
- In PowerShell, run
wsl --list --verboseand check Ubuntu uses version2. - Use the Ubuntu terminal for the remaining labs. WSL help.
Ubuntu
- Open Terminal with Ctrl+Alt+T on the standard desktop.
macOS
- Press Cmd+Space and search for Terminal.
- Open it; you do not need WSL.
Paste shortcuts
- Ubuntu/Windows Terminal: Ctrl+Shift+V.
- macOS: Cmd+V.
whoami
pwd
uname -sCheck:
whoamiprints your username.pwdprints your current directory.uname -sprintsLinux(Ubuntu/WSL) orDarwin(macOS).
Useful keys:
- Up: recall a command.
- Tab: complete a name.
- Ctrl+L: clear the view.
Install in Ubuntu/WSL#
sudo apt update
sudo apt install curl git nano openssh-client python3 python3-venv podmansudo: requests administrator privileges.apt update: refreshes the package catalogue.apt install: installs packages after confirmation.
| Tool | You will use it to |
|---|---|
curl, openssh-client | Send web requests; connect with SSH |
git, nano | Record versions; edit text |
python3, python3-venv | Run Python; create isolated environments |
podman | Run containers later; check installation here |
Install on macOS#
Run these version checks:
curl --versiongit --versionnano --versionssh -Vpython3 --version
- Git missing? Run
xcode-select --installand complete Apple’s installer. - Python missing? Use the official installer; it includes
venv. - nano missing? Use a plain-text editor for the named files.
- Podman is optional here; see its macOS installation guide. Do not run
apton macOS.
Install uv on either system#
Use the official uv installer:
- Download it with
curl. - Inspect it with
less; pressqto exit. - Run it with
sh.
curl -LsSf https://astral.sh/uv/install.sh -o /tmp/tds-uv-install.sh
less /tmp/tds-uv-install.sh
sh /tmp/tds-uv-install.shcurl options:
-L: follow redirects.-sS: hide progress but show errors.-f: fail on HTTP errors.-o: choose the output file.
- Reopen Terminal.
- Check
uv --versionworks. - On Ubuntu, also check
podman --version. - If uv is missing, follow the installer’s PATH instruction; try
$HOME/.local/bin/uv --versionto locate it.
1.2 · Build and navigate your workspace
- Path: a file’s address.
- Absolute path: starts with
/, the filesystem root. - Relative path: starts from your current directory.
~: your home directory../..: the current directory / its parent.
Use a fresh folder name if bridge-lab already contains your work, and substitute it throughout these modules.
cd ~
mkdir -p bridge-lab/notes bridge-lab/scripts
cd ~/bridge-lab
pwd
ls
printf 'I can navigate.\n' > notes/navigation.txt
cat notes/navigation.txt
cp notes/navigation.txt notes/practice-copy.txt
mv notes/practice-copy.txt notes/renamed-copy.txt
ls -la notes| Command | Effect |
|---|---|
cd, pwd | Change directory; show where you are |
mkdir -p | Create directories, including missing parents |
ls -la | List details, including hidden names |
printf, cat | Produce text; display file contents |
> / >> | Replace a file’s contents / append |
cp, mv | Copy; move or rename |
touch file | Create an empty file if absent; otherwise update its timestamp |
- Check both files contain the same sentence.
- Run
cd notes, thencd ../scripts. - Predict where you are; verify with
pwd.
cd: changes directories; it does not create them.- Spaces: quote names, as in
cd "class notes". - Case: match the filename’s spelling and case.
- Home: typically
/home/NAMEon Ubuntu or/Users/NAMEon macOS. - WSL:
/mnt/cexposes the Windows C: drive; keep this lab in~.
Delete only your copy#
- Return with
cd ~/bridge-lab. - Run
rm -i notes/renamed-copy.txt. - Confirm the disposable filename before typing
y. - Check
notes/navigation.txtremains.
- Terminal deletion usually bypasses the desktop trash.
Your turn:
- Create
notes/shell.txt. - Append a sentence with
>>, then read the file. - Explain why repeating
>would lose the earlier sentence.
1.3 · Give a script permission to run
cd ~/bridge-lab
ls -l notes/navigation.txt
ls -ld scripts
nano scripts/hello.sh- Example:
-rw-r--r--splits into- | rw- | r-- | r--. - Groups: file type, owner, group, others.
- Type:
dmeans directory;-means regular file. - Permissions:
r/w/xmean read/write/execute. - Directories:
xpermits traversal; your permission values may differ.
Paste this into nano:
#!/usr/bin/env bash
learner="Explorer"
printf 'Hello, %s!\n' "$learner"
pwd- Save with Ctrl+O, then Enter.
- Exit with Ctrl+X.
- The first line selects Bash for direct execution.
learner="Explorer"stores text;"$learner"reads it.%sinserts that text;\nends the line.
bash scripts/hello.sh
chmod u+x scripts/hello.sh
./scripts/hello.shCheck:
- Both runs print
Hello, Explorer!and your current directory. bash fileasks Bash to read the script../fileexecutes it directly and needs execute permission.chmod u+xadds execute permission for the owner only.
Your turn:
- Change the name and run again.
- Move into
notesand run../scripts/hello.sh. - Explain whether
pwdreports the caller’s directory or the script’s directory.
Check your answer and common errors
pwd: reports the caller’s directory.PATH: lists where the shell searches for bare command names../: explicitly identifies a local file.No such file: check
pwdandls; paths depend on where you start.Permission denied: inspect
ls -land add owner execute permission.Bad interpreter / ^M: save with Unix/LF line endings, or recreate the file in nano inside Ubuntu.
Finish without copying#
- Open a new terminal and find your lab.
- Append a note and run the script.
- Explain why
cd ../scriptsdiffers fromcd /scripts.
- I reached
bandit3and can explain each file-reading command. - curl, git, python3 and uv report versions in my learning terminal.
- My Bash script prints my name; I can explain
chmod u+x. - My notes contain one solved error and one command worth remembering.
Explore:
- Open
man ls; pressqto exit. - Find an option and test it on your lab.
- If asking AI for help, share the command/error and request a hint.
- Verify the result yourself.
Next: Module 2: Python & uv →