003
LVL 00 — CADET PILOT SESSION 003 DAY 3

LINUX POWER TOOLS

SYS.SCENARIO
🏢 The IT admin gives you a checklist: "Before you get repo access, prove you can handle the terminal under pressure. Here's a log file from PixelCraft's server — 10,000 lines. Find the errors. Count them. Tell me which errors are most common. You have 15 minutes."
CONCEPTS.UNLOCKED
🔍
grep — Text Search
Find text in files. grep -r (recursive), -i (case insensitive), -n (line numbers), -c (count matches). The Swiss army knife of text.
📂
find — File Search
find . -name "*.js" (by name), -type f (files only), -size +1M (by size). Locate anything on your system.
|
Piping
The | operator sends output of one command as input to another. Chain simple tools into powerful pipelines.
>
Redirection
> (write/overwrite), >> (append), < (read from file). Control where data flows.
Text Processing
sort (sort lines), uniq (deduplicate), wc (count words/lines), head/tail. Each tool does one thing well.
Command History
history (see past commands), Ctrl+R (reverse search), !! (repeat last). Never retype a long command.
HANDS-ON.TASKS
01
Analyze the Log File

Given: pixelcraft-server.log (10,000 lines)

wc -l pixelcraft-server.log # How many lines? grep "ERROR" pixelcraft-server.log | wc -l # How many errors? grep "ERROR" pixelcraft-server.log | head -5 # First 5 errors grep "ERROR" pixelcraft-server.log | tail -5 # Last 5 errors
02
Find Error Patterns

Chain commands to find the top 10 most common error messages:

grep "ERROR" pixelcraft-server.log \ | sort \ | uniq -c \ | sort -rn \ | head -10
This is a data analysis pipeline. Five simple tools, piped together, answering a complex question in one line.
03
Save Results

Redirect output to files for later analysis:

grep "ERROR" pixelcraft-server.log > errors-only.log wc -l errors-only.log
04
Find Files
find ~/pixelcraft-workspace -name "*.txt" # All text files find ~/pixelcraft-workspace -name "*.txt" -type f # Only files (not dirs) find . -name "*.log" -size +100k # Large log files
05
Chaining Challenge

In one command, find all JavaScript files and count total lines of code:

find . -name "*.js" -type f | xargs wc -l | tail -1
xargs takes piped input and passes it as arguments to the next command. It's the glue between find and other tools.
06
Permissions & Processes

Permissions — who can read, write, execute:

ls -la # See permissions: -rwxr-xr-x chmod +x script.sh # Make a file executable

Process management — see what's running:

ps aux # All running processes ps aux | grep node # Find Node processes top # Live system monitor (q to quit)
CS.DEEP-DIVE

Unix Philosophy — "Do one thing well."

grep finds text. sort sorts. uniq deduplicates. wc counts. Alone they're simple; piped together they become a data analysis pipeline.

// This composability principle is the foundation of:

Session 28  → Function composition
Session 41  → React component composition
Session 99  → Design patterns
Session 100 → Microservices architecture
PixelCraft  → The filter pipeline you'll build

// Small, focused tools composed into powerful systems
// is THE design principle of software engineering.
"Log Detective"
[A] Given 3 log files from a "PixelCraft production incident," answer: When did the incident start?
[B] How many users were affected? What was the root cause?
[C] When was it resolved? Save your investigation as incident-report.txt.
REF.MATERIAL
VIDEO
Computerphile
Clear explanation of the Unix text processing trinity. Focus on grep for this session.
GREPUNIX
ARTICLE
Wikipedia
The design principles behind Unix that shaped all modern software engineering: do one thing well, compose tools via pipes.
PHILOSOPHYCOMPOSABILITY
BOOK
William Shotts (free PDF)
Redirection, piping, permissions, and processes — the chapters that match this session's material perfectly.
PIPINGPERMISSIONSFREE
TOOL
explainshell.com
Paste any shell command and get a visual breakdown of every flag and argument. Essential when reading unfamiliar commands.
REFERENCEINTERACTIVE
TOOL
OverTheWire
SSH-based wargame that teaches Linux commands through puzzles. Levels 0–10 reinforce everything from Sessions 2–3.
PRACTICEGAMIFIED
// LEAVE EXCITED BECAUSE
You analyzed 10,000 lines of data in seconds. You found patterns that would take hours to find manually. System administrators, data engineers, and DevOps professionals do exactly this. You're building real professional skills.