Several common ones are described in the following table. The syntax of the grep command is: # grep Instead of reading the entire log or stepping through a search term in a text editor, you can simply print all of the relevant lines to the screen with the grep command.
For example, you may want to audit a user’s login events by looking at an access log. In this way, you can use grep to both processes a text file and read the contents that are most pertinent to you. As output, grep displays each full line of the file that your search pattern was found in. Unlike find or locate, it is not limited to finding file names it is most often used to search the contents of a file for a particular string of text. The grep command, in its most basic form, is a search tool.