1

I know that tail -f /var/log/messages will be keep updating on screen as the contents of file gets updated. But when I tried the same thing with a debug file system's file it is not working , any idea?

I tried ftrace and tried this: tail -f trace it is not working ?

Note, I can see the contents actually getting by using watch -n1 cat trace.

kumar
  • 423
  • 2
  • 9
  • 23
  • 1
    The thing is, `tail -f` only works with files which are appended to. Maybe your debug file is not appended but overwritten with every run? –  Dec 30 '13 at 12:23
  • Does this answer your question? [Continuously monitor logs with tail that are occasionally rotated](https://serverfault.com/questions/53699/continuously-monitor-logs-with-tail-that-are-occasionally-rotated) – user202729 Oct 19 '21 at 15:42

1 Answers1

4

tail -f works on the file descriptor, not on the file name. If the file is being overwritten, or deleted and re-created, tail -f won't be able to track that.

In gnu tail there's the option --follow=name or -F which will track the file name rather than the inode/file descriptor.

Jenny D
  • 27,358
  • 21
  • 74
  • 110