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 progress
33%

Step 1 of 1

Fake log hunt

Fake log huntDrag stickies · tap for tips
Study mapDrag stickies · tap for tipsKeep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Assert the UIdrag · tap →Retry wiselydrag · tap →Seed datadrag · tap →Close the loopdrag · tap →Keep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Pathwise hackdrag · tap →Fake log huntdrag · tap →Try thisdrag · tap →Follow the dashed drag · tap →

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.log

Do 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.