There is a
watch command that runs a program every N seconds, showing you the most-recent output and optionally highlighting characters that have been changed.
I'm often using it's
--diff mode to see what changed since the last refresh interval, but then I have to make a tradeoff: do I want to see current data (use a low refresh interval) or have a good idea of how much of the output is changing (use a long refresh interval). Cumulative mode is too long, though. And the diff output is useless if a line is added/removed near the top, it'd be nice if that didn't highlight the entire screen.
- Runs on Linux, preferably in a terminal (CLI)
- Runs a command every N seconds (without time drift is preferred, but not required), and displays the output of that command.
- On the second, third, etc. refresh, highlights characters that have changed. Allows me to specify how many updates worth of changes I'd like to see (e.g., highlight characters that have changed in the past three refreshes, not just this one)
- Support UTF-8 reasonably well. E.g., understand that a character can consist of multiple bytes.
- Handle lines being added and removed without showing every character in every subsequent line as changed (e.g., attempt to resync like
diffdoes, though using a different algorithm is fine)
- Show how many refreshes ago the change was by using a different highlight color based on age. OK to require a 256-color capable terminal (e.g., to get a bunch of grays).
- Runs in a terminal, with no need for X11 (or Wayland).
- As mentioned above, mode to avoid time-drift (e.g., if you ask for every 30 seconds, and the command takes 5 seconds to run, it should still start it every 30s, not every 35s). [watch's
-poption, which I wrote...]
- Support for formatting escape codes from the program being run (e.g., color, bold, underline).
- History, where you could look at previous outputs. For example, pressing h or left could show you the output of the previous run, pressing it again the run before that, then l or right could take you to the next run, and again back to the most recent run.