nerdexam
CompTIACompTIA

XK0-005 · Question #311

XK0-005 Question #311: Real Exam Question with Answer & Explanation

The correct answer is D: tail -f /var/log/messages. To continuously monitor log files as new entries are added, the tail -f command is the appropriate choice, as it displays the last part of a file and then follows its growth.

System Management

Question

While installing third-party software, a technician wants to monitor logs on the system continuously. Which of the following commands should the technician issue to monitor the logs?

Options

  • Acat /var/log/kern.log
  • Bgrep -e /var/log/httpd/access.log
  • Chead -n /var/log/secure
  • Dtail -f /var/log/messages

Explanation

To continuously monitor log files as new entries are added, the tail -f command is the appropriate choice, as it displays the last part of a file and then follows its growth.

Common mistakes.

  • A. The cat /var/log/kern.log command displays the entire content of the kern.log file at once and then exits, making it unsuitable for continuous monitoring of new entries.
  • B. The grep -e /var/log/httpd/access.log command is syntactically incorrect; grep expects a pattern as an argument, not just a file, and it does not continuously monitor a file for new entries.
  • C. The head -n /var/log/secure command displays only the first n lines of the secure log file and then exits, which is not suitable for continuous monitoring of new entries.

Concept tested. Real-time log file monitoring

Reference. https://man7.org/linux/man-pages/man1/tail.1.html

Topics

#Log monitoring#Linux commands#tail command#System logs

Community Discussion

No community discussion yet for this question.

Full XK0-005 PracticeBrowse All XK0-005 Questions