I'll often use less to page through the output of a program that's going to keep producing output, such as with tail -f /var/log/messages | less. Is it possible to jump to the bottom of the current buffer when doing this?

Normally when using less with a program that's expected to terminate (grep <term> <files> | less, for example), you can press Shift+G, and less will wait for the program to terminate and the pipe to close, then jump to the bottom of the buffer. However doing this with a pipe that will never terminate just causes less to hang.

Instead, I'd like less to just go to the bottom of whatever has already come through the pipe; is that possible?

  • 1
    Why not just use tail -f, there is a flag to let it sleep for a few seconds while producing output so your screen doesn't get too flooded? – ryekayo Sep 23 '15 at 17:24

The first example you show can be trivially handled by less itself:

less /var/log/messages

and then hit shift+F which puts less into "follow" mode, which translates roughly to tail -f functionality.

I suspect the follow mode is what you're looking for.

  • Ooh, nice, thank you! Is there a way to leave that mode again without leaving less entirely? – me_and Sep 28 '15 at 10:40
  • Hit ctrl-C which will cancel the "follow" mode. – wurtel Sep 28 '15 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.