Lab 12: grep — Searching Text
Objective
Step 1: Basic grep
printf 'apple\nbanana\napricot\nblueberry\ncherry\n' > /tmp/fruits.txt
cat /tmp/fruits.txtapple
banana
apricot
blueberry
cherrygrep 'a' /tmp/fruits.txtapple
banana
apricotStep 2: Case-Insensitive Search (-i)
Step 3: Show Line Numbers (-n)
Step 4: Inverted Match (-v)
Step 5: Count Matches (-c)
Step 6: Extended Regex (-E) — Multiple Patterns
Step 7: grep on System Files
Step 8: Capstone — Log Threat Hunting
Summary
Option
Meaning
Last updated
