Bird
0
0

What will be the output of tail -f -n 5 /var/log/syslog when started?

medium📝 Command Output Q5 of 15
Linux CLI - Viewing and Editing Files
What will be the output of tail -f -n 5 /var/log/syslog when started?
AShows last 5 lines of the file and then waits for new lines
BShows the entire file and then waits for new lines
CShows last 5 lines only once and exits
DShows nothing until new lines are added
Step-by-Step Solution
Solution:
  1. Step 1: Understand -n 5 with -f

    The command shows the last 5 lines initially.
  2. Step 2: Understand continuous monitoring

    After showing last 5 lines, it keeps running to show new lines live.
  3. Final Answer:

    Shows last 5 lines of the file and then waits for new lines -> Option A
  4. Quick Check:

    -n 5 -f shows last 5 lines then follows [OK]
Quick Trick: Combine -n and -f to limit initial lines [OK]
Common Mistakes:
MISTAKES
  • Thinking it exits after showing lines
  • Expecting full file output
  • Assuming no output until new lines

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes