Output, Context, and Reporting/Show lines after each match

Include following context lines.

Section: Context lines

Show lines after each match

bash
bash
rg -A 3 'TODO' .
Explanation

Often used to inspect comments, config blocks, or stack traces.

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 lines
Show lines before each match
Include preceding context lines.
OpenIn sheetbashsame section
Show surrounding context
Print lines before and after each match.
OpenIn sheetbashsame section
Customize context separators
Make grouped output easier to parse visually.
OpenIn sheetbashsame section
Print all lines but highlight matches
Stream a file through rg without dropping non-matching lines.
OpenIn sheetbashsame section
Disable file headings
Print file names inline per match instead of grouped headings.
OpenIn sheetbash1 tag match
Print summary statistics
Show counts and timing information at the end of a search.
OpenIn sheetbash1 tag match