Bird
0
0

Why does tail -f sometimes fail to show new log entries after log rotation?

hard📝 Conceptual Q10 of 15
Linux CLI - Viewing and Editing Files
Why does tail -f sometimes fail to show new log entries after log rotation?
ABecause <code>tail -f</code> requires root permissions to follow rotated files
BBecause <code>tail -f</code> only reads the file once and exits
CBecause it follows the file descriptor, not the filename, so it watches the old file
DBecause log rotation deletes the file and <code>tail</code> cannot reopen it
Step-by-Step Solution
Solution:
  1. Step 1: Understand how tail -f tracks files

    tail -f follows the file descriptor (inode), not the filename.
  2. Step 2: Effect of log rotation

    When the log rotates, the old file is renamed and a new file created; tail -f keeps watching the old file descriptor, missing new entries.
  3. Final Answer:

    Because it follows the file descriptor, not the filename, so it watches the old file -> Option C
  4. Quick Check:

    tail -f follows descriptor, breaks on rotation = Because it follows the file descriptor, not the filename, so it watches the old file [OK]
Quick Trick: File descriptor tracking causes rotation issues with tail -f [OK]
Common Mistakes:
  • Thinking tail -f reads once and exits
  • Believing rotation deletes file permanently
  • Assuming root needed for rotated files

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes