[PLUG] Using less on a growing file

Galen Seitz galens at seitzassoc.com
Thu Sep 25 21:32:40 UTC 2014


On 09/25/14 14:16, Tim Wescott wrote:
> Is there a way to use less, or a less-like viewer, to view a growing
> file such that as the file grows, paging down will get me more and more
> content?
>
> As far as I can tell, just running 'less myfile.txt', when myfile.txt is
> being written to by another app, seems to just take a snapshot of
> myfile.txt -- I want to be able to look at the full extent of the file
> AS IT GROWS, to monitor ongoing long computations to see how they're
> doing.
>
> If you're tempted to just answer with "you don't want to do that" -- no,
> I do indeed want to do that, and I have good reason.
>

When I want to do that, I typically press 'G', followed by 'F'.  From 
the man page:

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  behavior  is
        similar to the "tail -f" command.)


BTW, if a file gets deleted and recreated while you have it open in 
less, I've discovered that entering and exiting the help screen('h' 
followed by 'q') will cause the new version of the file to be opened.

galen
-- 
Galen Seitz
galens at seitzassoc.com



More information about the PLUG mailing list