Follow a pipe using less?

Pressing F or G makes less try to reach input EOF. If the input is a pipe, less hangs until the pipe is closed on the other side (and not "does nothing").

This can be worked around by saving the command output to a temporary file in the background, and then by using it as input for less:

command > /tmp/x &
less +F /tmp/x; kill %; rm /tmp/x

There is no option to do this in less only; however, I admit it would be useful.


Can less follow (by pressing F) a piped input (similarly to a file)?

Yes, starting with version 474.

Related: Is there any way to exit “less” follow mode without stopping other processes in pipe?

For reference, the issue with F not working with pipes has reference number 300 on the list of known bugs and is titled The F command does not work on piped input.


A related remark holds for G (go to end): when piping directly to less, it won't work.

It works starting from version 466. Citing from release notes for this version:

New command ESC-G goes to end of currently buffered data in a pipe


From the less man page

[Keyboard] COMMANDS [...]

   F      Scroll  forward, and keep trying to read when the end of file is reached.  Normally this command would be used when already
          at the end of the file.  It is a way to monitor the tail of a file which is growing while it is being viewed.  (The  behav‐
          ior is similar to the "tail -f" command.)

so this should work, and it actually works for me.

Tags:

Pipe

Tail

Less