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.
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.logcommand displays the entire content of thekern.logfile at once and then exits, making it unsuitable for continuous monitoring of new entries. - B. The
grep -e /var/log/httpd/access.logcommand is syntactically incorrect;grepexpects 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/securecommand displays only the firstnlines of thesecurelog 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
Community Discussion
No community discussion yet for this question.