Find a word or phrase in files within a directory with a single command.
bash
grep -rn <PATTERN> <DIR_PATH>
Arguments:
#NameDescription1PATTERNText or pattern to search for2DIR_PATHDirectory to search in
bash
grep -rn "TODO" /home/user/project
Output:
text
/home/user/project/main.py:12:# TODO: fix this
/home/user/project/utils.py:5:# TODO: add tests
Format: FILENAME:LINE_NUMBER:MATCHING_LINE