grep searches the named input files for lines containing a match to the given pattern. By default, grep prints the matching lines. A file named - stands for standard input. If no input is specified, grep searches the working directory . if given a command-line option specifying recursion; otherwise, grep searches standard input. There are four major variants of grep, controlled by the following options.
In addition, two variant programs egrep and fgrep are available. egrep is the same as ‘grep -E’. fgrep is the same as ‘grep -F’. Direct invocation as either egrep or fgrep is deprecated, but is provided to allow historical applications that rely on them to run unmodified.