What is grep used for?

grep is a popular Unix command that is used to search plain-text data sets for lines that match a pattern or regular expression. grep (global regular expression print) was originally developed for the Unix operating system, but later available for all Unix-like systems.

An example of using the grep command to search for a keyword in a file: grep keyword file.txt

You can pipe the output of other commands into grep. For example, grep can be used to search a directory for a file: ls ~/Desktop | grep keyword