Manuals / Linux & CLI for Testers / Chapter 3
A · Basics · beginner · ~35 min · Chapter 3 of 9
Reading files & pipes
cat, less, head, tail, grep, sort, uniq, wc. Pipes and redirects are how you investigate.
Path progress33%
Step 1 of 1
Fake log hunt
Example
printf 'INFO ok\nERROR boom\nINFO ok\nERROR boom\n' > ~/cli-lab/logs/app.log
grep ERROR ~/cli-lab/logs/app.log | wc -l
tail -n 20 ~/cli-lab/logs/app.logDo this now
Generate a log file with repeated lines; find ERROR counts with pipes.
Was this step clear?
Chapter learning outcomes
- Pipes
- grep
- tail -f
Clear these before you leave
Side quest
Real log
On a safe env, `tail -f` a log while reproducing a bug once.