What is `grep` command and how to use it?

grep is a command-line utility for searching plain-text data sets for lines that match a regular expression or a particular string. It will search for the string or regular expression in the input data and print all matching lines.

Syntax: grep [options] pattern [files]

Check the manual page for grep to see the option details.

For every command in linux there is a man page. Please see it, just type man and followed by that command, you can get all the information about that command and also you could know how to use it.
(or)
For almost all commands there is a help option associated with it, please search google how to extract command information using help option. You could get all information about that command.

1 Like