grep is a Command Line Interfacetool to search (‘grep’) for text in files and return lines that match.
Some useful command line options:
-i # Case insensitive matches
-A # Show context (A)fter the match - takes a numerical argument like "-A 3" shows 3 lines after
-B # Show context (B)efore the match - takes a numerical argument like "-A 3" shows 3 lines before
-E # Used to pass a regular expression (regex) to search foreground
-v # invert - show all lines that DON'T match
-l # show filenames of the files tahct match
-F # don't treat match string as a regex
-r # recursively search all files in a directory and child directories
-o # only print the part of the line that matches
-a # search binaries - these are ignored by default
Grep alternatives: ack, ag, ripgrep.