Last Updated: February 25, 2016
·
1.78K
· lepht

A better way to tail logs

You can use less +f instead of everyone's favorite tail -f[1] when watching a log. This gives you the 'following' behavior of tail with the buffer navigation features of the less pager, allowing you to search, scroll, etc.

[1]: tail mini pro-tip: if you're following a log file that gets rotated, use tail -F with a capital 'F' to have tail automatically switch to tailing the new file when it gets rotated.

2 Responses
Add your response

I use screen, so can normally scroll up a bit, but I imagine this will go all the way back to the beginning of captured output rather than the scroll-back buffer. Neat!

over 1 year ago ·

Other way is to start less -R (the -R solves problems with colors) and then press F for the "tail" behavior inside less (and control-C to get out of the tail, gg to go to start, and G to go to complete EOF).

over 1 year ago ·