CompTIA

XK0-006 practice question 9

CompTIA Linux+ · free question 9 of 20

Question

A systems administrator wants to review the logs from an Apache 2 error.log file in real time and save the information to another file for later review. Which of the following commands should the administrator use?
  • A. tail -f /var/log/apache2/error.log > logfile.txt
  • B. tail -f /var/log/apache2/error.log | logfile.txt
  • C. tail -f /var/log/apache2/error.log >> logfile.txt
  • D. tail -f /var/log/apache2/error.log | tee logfile.txt Correct

Explanation

tail -f follows the log as new lines arrive, and piping it into tee copies standard input both to the screen and to logfile.txt, so the administrator watches the log live and keeps a copy. The > and >> redirections send the output only to the file, so nothing appears on the screen in real time. Piping into logfile.txt is invalid because a pipe needs a command, not a file name.

Practice the whole free set

Answer all 20 free XK0-006 questions with instant feedback, or unlock all 154 questions with Learn and Exam modes.