What you will learn
- Filter lines with grep
- Edit streams with sed
- Extract fields with awk
New to this? Start here
The basics, in plain English
A huge part of the job is reading and changing text: log files, config files, lists. Linux has three classic tools for slicing text quickly. You do not need to master them today, just know what each one is for.
- Text stream
- A flow of lines of text, such as the contents of a file or the output of a command.
- grep
- A search tool. It scans text and prints only the lines that match a word you are looking for.
- sed
- A find-and-replace tool for text, like the replace feature in a word processor but on the command line.
- awk
- A tool that pulls out specific columns from each line and can do simple math on them.
- Pipe ( | )
- A symbol that sends the output of one command straight into the next, chaining tools together.
01
Pipelines
Unix philosophy: small tools that do one thing, joined with pipes. grep filters, sed edits, awk extracts and computes on columns.
02
Real usage
These show up constantly in log analysis, CI scripts, and quick reporting. Worth investing real time.
Try it yourself
bash
$grep -i 'error' app.log↳Find every line containing “error”, ignoring case.$sed -i 's/DEBUG/INFO/g' config↳Replace DEBUG with INFO everywhere in the file, in place.$awk '{print $1}' access.log | sort | uniq -c↳Pull the first column, then count how often each value appears.$grep -c 500 access.log↳Count how many lines mention a 500 error.↳ lines explain what each command does — only the commands get copied
Finished this topic?
Mark it done to earn 100 XP and keep your streak alive.