jlevy / the-art-of-command-line

Master the command line, in one page
152.79k stars 14.53k forks source link

tail -f -F as a must. #147

Open gilleslamiral opened 9 years ago

gilleslamiral commented 9 years ago

In Basics section.

tail -f (or even better, less +F), tail -f -F (or even better, tail -f -F),

Better than tail -f is also tail -f -F which gives a perfect way to deal with long tail -f regardless of logrotate mechanisms. It avoid to be surprised by rotations logs, ie, seeing no more log lines while there are ones, and allow long time tails. A must, once tasted.

Command tail follows several files permanently. Command less +F does not, one has to go to next file. Not better than less in that case.

jlevy commented 9 years ago

Sure, good point. Don't think you need the -f if you are using -F.

Can anyone think of a reason then not to change the recommendation to tail -F instead of tail -f across the board?

heydonovan commented 9 years ago

Eh, I use both less +F and tail -F on a daily basis, both have their strengths. With less, I can turn word-wrap on and off at will (less -S), which one cannot do in tail. :/

Neirda24 commented 9 years ago

@heydonovan : Maybe you can add a few lines explaining (examples) on when you use one instead of the other ?

ajcrites commented 8 years ago

May be unrelated, but tailf is also handy for log inspection.

chrissprague commented 8 years ago

You don't need both flags, it's just tail -F /path/to/your/log. FWIW, I have used tail -f often and just now from this discussion learned about using -F instead, in this case for accounting for log rotations. Another benefit is that since the logging continues, you'll know the tail job is still running (whereas with -f if it was bg'd you might forget it was ever running after a rotation "breaks" the tail, for example).

So I'd say changing it to -F would be beneficial. If it's still unclear, it may be worth briefly explaining the implications of both.