Phase 0: Command Line & OS Literacy · ~35 minutes · Terminal · grep · sort
Reading, Filtering, and Combining Text
grep "error" on a file full of ERROR returns nothing. No error message. Just silence — and a wrong conclusion, if you don't know to expect it.
Real-world application: Composes small tools with pipes instead of reaching for a script, and knows exactly why a pipe returned nothing
What you will learn
- Use cat/head/tail/grep/sort/uniq as small, composable tools
- Chain commands with pipes to answer a question no single command answers alone
- Explain why pipes pass plain text, not structured data, and what that implies
- Diagnose a pipe that silently returns nothing due to a near-miss match
Introduction
- Type: Learn
- Languages: Bash / Zsh
- Prerequisites: Navigating Without a Mouse
- Time: ~35 minutes
Objective
Learning objectives
- Use
cat/head/tail/grep/sort/uniq as small, composable tools - Chain commands with pipes to answer a question no single command answers alone
- Explain why pipes pass plain text, not structured data, and what that implies
- Diagnose a pipe that silently returns nothing due to a near-miss match
What you're building
Using a real (synthetic is fine) server log file with at least 30 lines, a mix of INFO/WARNING/ERROR levels, and at least 2 different dates:
- Answer "how many errors happened on [a specific date in your log]" using only a piped command chain
- Answer "what are the 3 most common non-INFO messages" using
grep, cut, sort, and uniq -c chained together - Deliberately reproduce this lesson's case-sensitivity trap: run a
grep that should match but doesn't due to case, show the empty result, then fix it with -i - Save all three commands and their real output in
log_analysis.txt
A command grep "Timeout" server.log | wc -l returns 0, but you can see with your own eyes that the file contains lines with the word timeout (lowercase). What's the most likely explanation and correct next step?
This is exactly this lesson's central trap, applied without the answer already given. grep "Timeout" (capital T) does not match lines containing lowercase timeout — no error, just a silently empty result, identical in appearance to 'this genuinely isn't in the file.' The fix demonstrated in this lesson's predict block is grep -i, which matches regardless of case. Nothing here indicates file corruption or a broken wc — the pipeline is working exactly as literally instructed, which is the whole point: the tools aren't wrong, the assumption about matching was.
This lesson is free
You've read the first 2 sections. The rest covers The Problem, Check Yourself, Key Terms & Next. A free account opens all of it, with its practice questions and its lab. No card.
Create a free account — the opening phases of 29 of 35 courses, and the first lesson of every phase, are free, no credit card.
Browse all courses · View pricing · DeVenture Academy