Manuals / Linux & CLI for Testers / Ch 3

A · BasicsBeginner35 min read

3. Reading files & pipes

Linux & CLI for Testers · 36 pages source format

cat, less, head, tail, grep, sort, uniq, wc. Pipes and redirects are how you investigate.

What you'll learn

  • Pipes
  • grep
  • tail -f

Fake log hunt

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.

Clear?

Checklist