XK0-006 System Management Practice Question
Which of the following commands will display the last 10 lines of a log file and also output new lines as they are appended?
⚠ Common exam trap
Watch out — candidates often confuse `tail -f` with `less +F` (which also works but uses a different syntax) or mistakenly think `head` can follow a file, but the exam expects precise knowledge of the `tail -f` command as the standard for real-time log viewing.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
tail -f logfile
The `tail -f logfile` command displays the last 10 lines of the file by default and then continues to monitor the file for new lines, outputting them as they are appended. The `-f` (follow) option keeps the file open and polls for changes, making it the standard tool for real-time log monitoring.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
head -f logfile
Why it's wrong here
head prints the first lines of a file, so it shows the oldest entries rather than the last 10, and -f alone cannot seek to the end. head -f is used when monitoring the beginning of a growing file, such as a header or initialisation log.
- ✗
less +F logfile
Why it's wrong here
less +F opens the file in follow mode but does not restrict output to the last 10 lines; it displays from the current position and waits. less +F suits interactive browsing of a log while it grows, not a fixed tail of 10 lines.
- ✓
tail -f logfile
Why this is correct
The -f flag makes tail follow the file descriptor, printing appended lines as they are written rather than exiting after the last 10. This satisfies both requirements: the default last-10-lines display plus continuous live output.
- ✗
cat logfile
Why it's wrong here
cat displays the whole file once, does not follow.
Go deeper
Related to this question
About these practice questions
Courseiva writes every XK0-006 question from scratch — 781 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This XK0-006 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the XK0-006 exam.