Linux Command Cheat Sheet/Search recursively under a directory

Search all matching files in a tree.

Section: Searching and Pattern Matching

Search recursively under a directory

bash
bash
grep -RIn 'TODO' src/
Explanation

A standard codebase search when ripgrep is unavailable.

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 Searching and Pattern Matching
Search text with grep
Print lines matching a pattern.
OpenIn sheetbashsame section
Show non-matching lines
Exclude lines that match a pattern.
OpenIn sheetbashsame section
Extended regex search
Use extended regular expressions with grep.
OpenIn sheetbashsame section
Fixed-string search
Match text literally instead of as a regex.
OpenIn sheetbashsame section
Fast recursive search with rg
Recursively search text quickly while respecting ignore rules.
OpenIn sheetbashsame section
Find files by modification time
Search for files changed recently.
OpenIn sheetbashsame section