In Linux, which command is used to display a continuous output of a specific log file?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Boost your Linux skills with the CompTIA Linux+ Certification Exam simulator. Engage with multiple choice questions and detailed feedback. Master Linux concepts and prepare for your exam with confidence!

The command that displays a continuous output of a specific log file is tail -f /var/log/kern.log. This command is particularly useful for monitoring log files in real-time, as it streams the last few lines of a log file and updates the output as new data is appended to the file. The '-f' (follow) option specifically allows the user to see live updates, making it a valuable tool for system administrators diagnosing issues or keeping an eye on system activity.

In contrast, the other commands serve different purposes:

  • Using cat /var/log/syslog would simply display the entire content of the syslog file at once and would not provide live updates.
  • The command head -n 10 /var/log/messages would show only the first 10 lines from the messages log, which is not continuous and, therefore, does not meet the requirement of ongoing output.
  • Finally, less /var/log/syslog allows for viewing the content of the syslog file in a paginated manner, but it does not continuously update, so it wouldn't be suitable for real-time log monitoring.

Thus, tail -f is the appropriate choice for anyone needing to actively monitor a log file's content as it changes.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy