Print 3 lines before each match.
Section: Context Around Matches
Show lines before a match
bash
bash
grep -B 3 ERROR app.logExplanation
Before-context is useful when logs explain the lead-up to an error.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Context Around Matches