grep and Its Flags
What this is. grep pattern file prints every line of the file containing the pattern. That is the whole idea, and the flags are what make it powerful.
-i ignores capitalisation.
-n prints line numbers.
-r searches a whole directory tree recursively.
-v inverts, printing lines that do not match.
-c prints a count instead of the lines.
The combination you will use most. grep -rn "TODO" . searches every file beneath the current directory, prints the filename and the line number for each hit, and is genuinely how developers find things in unfamiliar code. Adding -i on top makes it case insensitive, giving grep -rni, which is a sequence worth committing to muscle memory.
Mark this lesson complete
Signed in, your progress follows you to every device.