Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which of the following Linux commands is/are used to search content from files?

Commands:
i) grep
ii) egrep
iii) fgrep
iv) find
v) tail
vi) tr

  • A.i, ii and iii only
  • B.ii, iii and iv only
  • C.v and vi only
  • D.iv only

Answer: A

The commands that search content from files are grep, egrep and fgrep, so i, ii and iii only. All three look for text patterns inside files. The command find searches for files by name or other attributes and not by what is inside them, tail prints the last lines of a file, and tr translates or deletes characters from its input. So the options with find, tail or tr are wrong. For example, grep pattern file prints the lines of the file that contain the pattern, and egrep and fgrep are variants for extended expressions and for fixed strings.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.