Day 6 Β· The workshop

The Terminal & Linux

You will be able to
  • Navigate the filesystem tree with pwd/ls/cd and manipulate it with mkdir/cp/mv/rm
  • Inspect files with cat, less, head, and tail without opening an editor
  • Chain tools with pipes and redirect output with > and >>
  • Search content with grep and find files by name with find
  • Read and change permissions, use environment variables and PATH, and write a runnable shell script
Today's ~120 minutes
Spaced-rep warm-up: Days 1–5 flashcards10 min
Concept study: ELI5 + tech (tree, pipes, permissions, PATH)20 min
Guided: navigation drill, pipeline lab, first shell script50 min
Practice: the scavenger hunt15 min
Project: the backup ritual15 min
Quiz + flashcards10 min

Builds on: Day 1 β€” Opening a terminal, running scripts Β· Day 5 β€” Files and paths

The analogy

Your computer's desktop β€” windows, icons, double-clicks β€” is the showroom: polished, safe, and slow. The terminal is the workshop out back, where the real tools hang on the wall. Each tool does exactly one job and does it fast: ls lists what's on the bench, grep is a magnet that pulls matching lines out of any pile, head snips the first few lines off. In the showroom you'd click through folders for a minute; in the workshop you type one line and you're done.

The workshop's superpower is the conveyor belt: the pipe symbol | feeds one tool's output straight into the next. "Take this log, keep only the ERROR lines, count them" is cat log | grep ERROR | wc -l β€” three small tools snapped together into a machine nobody had to build in advance. That composability is why, fifty years on, this is still how professionals drive computers. Every cloud server you will ever touch (Day 151) has no showroom at all β€” only the workshop. Today you earn your keys to it.

Why this matters on the job

AI engineers live in terminals: every deploy, every docker command (Day 148), every git operation (Day 8), every SSH session into a customer's VPC (Day 170) is terminal work. Production servers have no GUI β€” when an FDE debugs a live incident, it's tail on a log file and grep for the error ID, under time pressure, on a machine they've never seen. Interviewers notice terminal fluency in the first five minutes of a pairing session; it reads as "has actually operated software," which is precisely the signal FDE hiring screens for. The pipes-and-filters idea also returns as Day 11's generator pipelines β€” same design, inside Python.

Guided practice

guided 1

Navigation drill β€” moving without the mouse

15 min
  1. Open a terminal (Windows users: use WSL or Git Bash for today β€” the commands below are the Unix set used on every server). Run pwd, then ls, then ls -la. Identify one hidden file (starts with a dot).
  2. cd to your ai-engineer-journey folder using tab-completion the whole way β€” type the first 2–3 letters of each folder and hit Tab. From now on, typing a full folder name by hand is a foul.
  3. Build a sandbox to destroy: mkdir -p sandbox/inner, then cd sandbox. Create files fast with: echo "hello from the workshop" > a.txt and cp a.txt b.txt. Rename with mv b.txt notes.txt. Check each step with ls.
  4. Practice relative paths: from inside inner/, run ls .. then cat ../a.txt then cd ../.. and pwd. Say each path out loud as a sentence ("the parent's a.txt").
  5. Destroy the sandbox: cd out of it, then rm -ri sandbox β€” answer the prompts. Note the feeling: rm has no undo, so -i (interactive) is your seatbelt while learning.
🐍 python β€” editable, runs in your browser
Ctrl/⌘+Enter runs · Tab indents · numpy/pandas/sklearn auto-load on import (torch and network calls need a local run)
guided 2

Pipes and grep β€” build report machines

20 min
  1. First, manufacture a realistic log to practice on. Save the Python snippet below as make_log.py in week-01 and run it β€” it writes app.log with 200 timestamped lines (INFO/WARN/ERROR from a handful of fake IPs).
  2. Inspect without an editor: head -n 5 app.log, tail -n 5 app.log, less app.log (search inside less by typing /ERROR, n for next match, q to quit).
  3. Build up a pipeline one stage at a time, running after each: grep ERROR app.log β€” then add | wc -l to count. Then the report classic: grep ERROR app.log | sort | uniq -c | sort -rn | head -n 3 (top repeated error lines). Read it left to right as a conveyor belt.
  4. Save a report: grep -c ERROR app.log > report.txt, then APPEND the warning count with >>. cat report.txt to verify both lines landed.
  5. Two more reps: grep -v INFO app.log | head (everything except INFO), and find ~ -name "*.json" 2>/dev/null | head (where did your JSON files land this week? β€” the 2>/dev/null discards permission-denied noise from stderr).
🐍 python β€” editable, runs in your browser
Ctrl/⌘+Enter runs · Tab indents · numpy/pandas/sklearn auto-load on import (torch and network calls need a local run)
guided 3

Permissions, PATH & your first shell script

15 min
  1. Run ls -l app.log and decode the permission string in a comment-line of your journal: who can read it? Write to it? Execute it?
  2. Explore your environment: echo $HOME, echo $PATH (note the colon-separated directories), and which python β€” that answer is PATH doing its job: the shell searched those directories in order.
  3. Set a variable and prove inheritance: export GREETING="hello from the environment", then run python -c "import os; print(os.environ['GREETING'])". This export-then-read pattern is exactly how API keys reach your code from Day 16 onward.
  4. Create greet.sh with the code below (nano greet.sh or use VS Code). Try ./greet.sh β€” permission denied. Fix it: chmod +x greet.sh, run again. That two-step (write script, make executable) is a ritual you'll repeat for years.
  5. Read one man page for real: man grep, find the -c flag inside it (type /-c then Enter), then quit with q.
🐍 python β€” editable, runs in your browser
Ctrl/⌘+Enter runs · Tab indents · numpy/pandas/sklearn auto-load on import (torch and network calls need a local run)

On your own

The scavenger hunt

15 min

Answer every question below using ONLY the terminal β€” no editor, no file manager. Record each command and answer in scavenger.txt (build it up with >> redirection).

  1. How many .py files exist anywhere under your ai-engineer-journey folder?
  2. Which of your Python files contain the word "json" (case-insensitive), and on which line numbers?
  3. What are the 3 most frequent IP addresses in app.log? (Hint: ERROR lines or all lines β€” your choice, but the pipeline is grep/awk-free: you can cut with spaces or just sort | uniq -c the full lines from a grep for one IP at a time... or discover the cut command with man cut for style points.)
  4. How many TOTAL lines of Python have you written this week? (find + cat + wc, or discover xargs.)
  5. What is the newest file in your week-01 folder? (man ls β€” look for a sort-by-time flag.)

Constraints: every answer line in scavenger.txt must be appended with >>, never >. If you wipe the file, that's the Day 5 lesson billing you twice.

Ship before you stop

The backup ritual

Write backup.sh, a shell script that snapshots your journey folder. It must: (1) build a timestamped folder name like backups/journey-2026-08-11 using $(date +%F); (2) create the backups directory with mkdir -p; (3) copy week-01 into it with cp -r; (4) append one line to backups/backup.log recording the date and how many files were copied (find + wc -l); (5) print a friendly done message. Make it executable, run it, verify with ls and cat. Run it again tomorrow morning β€” rituals only count if repeated. Keep backups/ OUT of the folder being copied (put it as a sibling), or your backups will recursively swallow themselves β€” reason it out before you run.

Rubric β€” check what you completed (0/5)

Common mistakes & misconceptions

  • Running rm without thinking. There is no trash can β€” rm is permanent. Use rm -i while learning, and treat rm -rf as a loaded tool: read the path twice, especially with wildcards.
  • Using > when you meant >>. Same trap as Day 5's "w" vs "a": one character silently wipes the file. Appending logs and reports is almost always what you want.
  • Putting spaces around = in shell assignments: NAME = "x" fails; it must be NAME="x". The shell parses spaces as argument separators, not decoration.
  • Believing "command not found" means the tool is missing. Often it exists but is not on PATH, or your PATH differs between terminals. which and echo $PATH diagnose it β€” the Day 1 two-Pythons problem was this in disguise.
  • Ignoring stderr. 2>/dev/null hides errors from a pipeline β€” great for find's permission noise, terrible as a habit. Know which stream your output is on before you silence one.
  • Editing PATH or shell config by copy-pasting internet advice without reading it. One bad line in your shell profile breaks every future terminal. Change one thing, open a new terminal, verify.
Knowledge check

Q1. What does the pipeline "grep ERROR app.log | wc -l" print?

Q2. You create script.sh and type ./script.sh β€” "Permission denied". The fix?

Q3. What is PATH?

Go deeper β€” curated resources

courseMIT Missing Semester β€” Course overview + the shell β†—50 mincourseMIT Missing Semester β€” Shell tools and scripting β†—45 mincourseMIT Missing Semester β€” full course index (bookmark it) β†—5 min
If you have a third hour
  • tail -f and following live logs β€” Start python make_log.py in one terminal modified to write slowly in a loop, and tail -f app.log in another. Watching a log grow in real time is the primal production-debugging experience β€” Day 142 gives it structure with tracing.
Done means
  • Navigation drill done with tab-completion throughout; sandbox created and removed
  • Top-3-errors pipeline built stage by stage and explained aloud
  • greet.sh and backup.sh both executable and run successfully
  • All five scavenger answers recorded via >> in scavenger.txt
  • Quiz β‰₯ 2/3 (rerun the pipeline lab if you missed question 1)
How this connects

← Back: The > vs >> trap is Day 5's "w" vs "a" wearing overalls, and echo $GREETING reaching Python closes the loop on Day 1's "shell and REPL are different worlds" β€” now you pass data between them deliberately.

Forward β†’: Day 8's git lives entirely in this terminal. Day 16 reads config from the environment variables you exported today; Day 39 explains what processes and file descriptors really are; Day 148's Docker containers are driven by these exact commands; and tail -f on a production log is how Day 172's customer debugging sessions actually look.

Unlocks: D8 Git β€” Your Time Machine Β· D16 Logging, Config & CLI Ergonomics Β· D17 Packaging & Environments Β· D39 Operating Systems Essentials