in Linux by
Explain grep command and its use.

2 Answers

0 votes

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

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
+1 vote
asked Feb 17, 2021 in Linux by SakshiSharma
0 votes
asked Nov 11, 2020 in Linux by sharadyadav1986
0 votes
asked Dec 17, 2020 in SVN by SakshiSharma