Under a UNIX shell, how can I get a similar effect to the watch
command, but with paging so that I can scroll around in the output if it takes up more than one screen?
In other words, I want a program that is to watch
what less
is to cat
.
As an example, lets say I wanted to watch the output of qstat
, I could use
watch qstat
to watch the output of qstat, but this can only shows the first screenful.
With a paging version of watch
, I would be able to move around in the output as it is still continuously updated by watch
. Is there any way to do this at the moment with existing utilities?
Best Answer
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:
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.