CMD Master
Back to Blog
•Updated•Arnošt Havelka

Bash Ripple Practice: Incident Combo

Run a two-step incident extraction and counting workflow with reproducible outputs.

Start Interactive Lesson
Bash Ripple Practice: Incident Combo

This capstone practice combines filtering, redirection, and counting under light pressure. You isolate warning lines first, then verify incident volume in a second command.

Commands to Practice

printf '%s\n' 'WARN: slow' 'INFO: retry' 'ERROR: timeout' > incidents.log
grep 'WARN' incidents.log > warn.txt
cat warn.txt | wc -l

Expected Terminal Signal

After extraction, warn.txt should contain only warning lines. Counting the file should return:

2

Why This Matters

Incident triage often needs a fast answer to two questions: "which lines matter?" and "how many are there?" This pattern answers both with minimal command overhead.

Common Mistakes

  • Filtering without saving output, forcing rework.
  • Counting the wrong file after extraction.
  • Ignoring case/keyword conventions in the source log.

Practice Extension

Add a second filtered report:

printf '%s\n' 'WARN: slow' 'INFO: retry' 'ERROR: timeout' > incidents.log
grep 'ERROR' incidents.log > error.txt
cat error.txt | wc -l

By repeating the same pattern with different severities, you build a reusable triage toolkit.

References

These documentation links provide authoritative details for the commands used in this article.

Up Next

How to List Running Processes in Bash with ps

Use ps in Bash to list running processes, read PID and owner columns, inspect one process, and choose when a live top view is more useful.