Is there a paging version of `watch`?

Solution 1:

Rather than modifying the 'watch' command, use screen!

For example, let's say that you need to be able to see 300 lines of height and 100 characters of width and move around that. After starting screen, force the size thus:

C-a :height -w 300
C-a :width -w 100

Now start your watch command. You can then use C-a <ESC> to page around the display.

Unfortunately, the display doesn't refresh while in copy mode. But if you want to adjust which section of the window you're viewing, the easiest way may be to rerun the height/width commands as by default your terminal shows the lower-right of the virtual window.

Solution 2:

You can try this:

$ while vmstat; do sleep 1; done | less

replace vmstat with qstat and adjust the sleep to your needs.

Solution 3:

Multitail: http://www.vanheusden.com/multitail/

Example:

 vmstat 1 |multitail -j

Scroll back by press 'b' and page/arrow up/down.

Solution 4:

OK, I've had a little go at a watchless function. It's a bit rough, and it doesn't yet appear to completely work, but here goes:

#!/bin/bash -u
out=$(mktemp)
(while [ 1 ]; do
    "$@" > $out;
    sleep 2;
done) &
less $out
kill $!

You have to manually use the R key in less to get the display to update.

It appears to work for watchless date but not for watchless qstat or watchless pstree, which both show blank. Any ideas?