Here are some of the most common grep commands used in the Unix/Linux command line:
grep 'pattern' file
grep -i 'pattern' file
grep -r 'pattern' /path/to/directory
grep -w 'pattern' file
grep -n 'pattern' file
grep -v 'pattern' file
grep -c 'pattern' file
grep -o 'pattern' file
grep -e 'pattern1' -e 'pattern2' file
grep -l 'pattern' file1 file2
grep --exclude=*.log 'pattern' /path/to/directory/*
grep -E 'pattern' file
grep -s 'pattern' file
Before matches:
grep -B n 'pattern' file
grep -A n 'pattern' file
grep -C n 'pattern' file
grep -L 'pattern' file1 file2