GREP COMMAND CHEATSHEET
i grep -i pattern file Case insensitive search
A grep -A n pattern file Show n lines after the match
B grep -B n pattern file Show n lines before the match
C grep -C n pattern file Show n lines before and after the match
v grep -v pattern file Show lines that do not match
c grep -c pattern file Count number of matching lines
I grep -l pattern file Display only the file names
w grep -w pattern file Match the exact word
e grep -e regex file Match the regex pattern
a grep -a pattern file Search into binary files
r grep -r pattern file Recursively search into directory
Click here for examples
Grep Command in Linux