LFCS tail -f Practice Question
A user wants to continuously monitor a log file that is being written to by a running service. Which command achieves this?
⚠ Common exam trap
It's easy for candidates to confuse `tail -f` with options that only show static content, such as `head` (which shows the beginning of a file) or `tail` without `-f` (which shows the end but does not follow).
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 /var/log/syslog
The `tail -f` command displays the last 10 lines of a file by default and then continues to output new lines as they are appended, making it ideal for real-time monitoring of a growing log file. The `-f` flag (follow) keeps the file open and polls for changes, typically using inotify on Linux, to output new data immediately.
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 -20 /var/log/syslog
Why it's wrong here
`head` displays the first lines of a file, not the last, and does not follow.
- ✗
less /var/log/syslog
Why it's wrong here
`less` is an interactive pager that does not automatically follow new content.
- ✓
tail -f /var/log/syslog
Why this is correct
`tail -f` follows the file and outputs new lines as they are added, suitable for continuous monitoring.
- ✗
cat /var/log/syslog
Why it's wrong here
`cat` outputs the entire file at once and does not follow.
Go deeper
Related to this question
About these practice questions
Courseiva writes every LFCS question from scratch — 507 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 LFCS practice question is part of Courseiva's free Linux Foundation 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 LFCS exam.