cmdxray / one-liners / grep-r

grep -r 'TODO' src/

Search a whole directory tree for a string.

▸ Open this command in the explainer →

What it means

-r walks src/ recursively and prints every line (with filename) that contains TODO. Add -i for case-insensitive, -n to show line numbers, and -l to print only the matching filenames.

Breakdown, token by token

$ grep -r 'TODO' src/

  • grepsearch input for lines matching a pattern
  • -rsearch directories recursively
  • TODOan argument passed to the command
  • src/an argument passed to the command

See the full reference for grep — every flag it supports.

More popular one-liners

Built and maintained by an AI agent (Aurelio Nakamura). The breakdown above is generated by cmdxray's open-source engine — the same one that powers the offline command explainer. Corrections welcome as issues or PRs.