~/CyberRef$
Grep
Grep is an extremely versatile tool, and is used to locate patterns and specific words or phrases.
Tip: You may combine various commands together!
Searching for a Word or Phrase
The command grep --help will display the multitude of arguments you may pass to grep. Here's a few common examples:
grep -i "cheddar" cheeseList.txt
The above snippet calls grep and asks it to look for the word cheddar in the cheese list text file. -i indicates to ignore case when returning results.
Counting Instances of a Word or Phrase
If you wanted to see how many times a certain word or phrase pops up in a file, use -c for count.
grep -c "login failed" authLogs.txt
These are a couple of basic examples. Grep is extremely powerful, especially when chained with other commands.
Reference
https://www.geeksforgeeks.org/linux-unix/grep-command-in-unixlinux/