• grep is a command line tool for searching plain text data sets in specific files.

The text search pattern is called a regular expression(REGEX).
When it finds a match, it prints the line with the result. The grep command is handy when searching through large log files.

  • Shell commands

    • Searching for pattern in files :

      > grep pattern files
      • Example :
        > grep root /etc/passwd
    • Searching recursively for pattern in dir :

      > grep -r pattern dir
    • Search for pattern in the output command :

      > command | grep pattern
    • Find all instances of a file :

      > locate file


Network & SSH