grep and its relatives.
WHAT grep DOES
Prints lines matching a pattern.
WHAT THE USEFUL OPTIONS ARE
Recursive, to search a whole tree Case-insensitive Show line numbers Invert, showing lines that do not match Count matches only List filenames only
WHY THE FILENAMES-ONLY OPTION MATTERS
When searching thousands of files, you want to know where, not what.
WHAT REGULAR EXPRESSIONS ADD
Patterns rather than fixed text.
WHAT THE BASICS ARE
A dot matches any character An asterisk means zero or more of the previous A caret anchors to the start of a line A dollar anchors to the end Square brackets match any one of a set
WHAT TO ESCAPE
Characters with special meaning, when you want them literally.
WHAT TO USE FOR PLAIN TEXT
The fixed-string option, which avoids surprises entirely.
WHAT CONTEXT OPTIONS DO
Show lines before and after each match.
WHY THAT HELPS IN LOGS
An error alone rarely explains itself.
WHAT TO COMBINE grep WITH
find, to search only certain files Pipes, to filter output from any command
WHAT TO SEARCH FOR AFTER A COMPROMISE
Suspicious function names in web files, with care about false positives.