The grep command means Global Regular Expression Print. This Linux command is one of the most useful commands out there. Below are some basic examples:
grep 'word' filename
grep 'word' filename1 filename2 filename3
grep 'string1' string2' filename
cat filename | grep 'something'
command | grep 'something'
Next example, you can search for the user ‘tom’ in the Linux passwd file:
grep tom /etc/passwd
You can instruct grep to ignore word case. Match abc, Abc, ABC and all possible combinations:
grep -i "tom" /etc/passwd