grep -C 3 'pattern' file.txt

Category: Text Processing

grep -C 3 'pattern' file.txt

Print 3 lines of context before and after match

Shows 3 lines before AND after each match — full context around every occurrence.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.