Certified Ethical Hacker CEH · Free Practice Question Easy

Question 72

You have several plain-text logs to review. Which of the following commands can be used to perform fast, efficient searches of the logs with regular expressions?
  • A search
  • B cat
  • C grep
  • D chmod
Reveal correct answer

Correct answer: C

Explanation

Correct Answer:

grep is correct.

Per grep’s man page, grep searches a file for lines containing a match to a given pattern. By default, grep prints the matching lines. In addition, two variant programs are available: egrep is the same as grep -E (interprets the pattern as an extended regular expression), and fgrep is the same as grep -F (allows you to use a list of fixed strings—any of which will be matched). Direct invocation as either egrep or fgrep is deprecated but is provided to allow historical applications that rely on them to run unmodified. 

Incorrect Answers:

cat, chmod, and search are incorrect.

The cat command reads a file to screen (or output to whatever you want), chmod changes permissions, and search does not exist.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need