I want to watch a file that gets overwritten every 5 minutes with
less. How can I make
less follow the new file descriptor instead of keeping the old one displayed?
watch "cat file" won't do it because the file is too long to fit into one terminal window.
You can get this effect by issuing the
Since your file only changes every 5 minutes, you could also use
EDIT: Due to misleading question, the above answer was unsatisfactory. Second attempt follows:
To re-open the same file in
This will spawn a subshell which backgrounds another shell process instructed to kill its parent process after 5 minutes. Then it opens the file with
The only easy way I know of to kill this is to kill the terminal your original shell is in. If that's unacceptable, you can use the "killfile" trick:
To stop doing
You can do something similar in
Start a server session of
Then in another console, monitor the file for updates and tell the vim session to reload the file as soon as it gets updated:
A few gotchas.
And if you want to have a more
Tail is your friend. "tail -f filename" will show you new lines when they appear.
Or if you are looking for changes made in the middle of the file, maybe run a script every few minutes to make a copy of the file to a temp location and do a diff on it?