Use '-F' with 'tail' instead of '-f'
24 March 2015
For the tail
, there is option -f
and there is option -F
. Which one to use?
What is the difference? Most of the time, I use -F
since it works with log
rotation etc.
-F
is equivalent to --follow=name --retry
. It is useful when log files would
be renamed or deleted, which is not uncommon in systems with log rotation.
- This option ensures that we are following the latest log. In contrast, if we
use
tail -f log_file
, we will be following that particular file even if it is renamed tolog_file.1
or deleted and hence miss new log messages. - Another cool thing about
-F
is that you can launch the tail command before log files are created.
blog comments powered by Disqus