+1 vote
in Linux by
Explain grep command and its use.

2 Answers

0 votes
by

grep command in Linux is used to search a specific pattern. Grep command will help you to explore the string in a file or multiple files.

The syntax for grep command:

  • grep ‘word’ filename
  • grep ‘word’ file1 file2 file3
  • command|grep‘string’
  • For example,
  • grep “smith” passwd
  • grep “smith” passwd shadow
  • netstat -an | grep8083
  • cat /etc/passwd | grep smith
0 votes
by

grep a search command that makes use of pattern-based searching. It makes use of options and parameters that are specified along with the command line and applies this pattern in searching the required file output.

Related questions

+1 vote
0 votes
+1 vote
asked May 11, 2021 in Linux by rajeshsharma
...