Watch Command – How to Scroll Within the Output of Watch Command

watch

I use the watch command to see the contents of my directory changing as a script runs on it (via watch ls dir/)

It's a great tool, except that I can't seem to scroll down or up to see all of the contents once the number of entries fills the vertical length of the screen.

Is there a way to do this?

Best Answer

watch is great, but this is one of the things it can't do. You can use tail to show the latest entries:

watch "ls -rtx dir/ | tail -n $(($LINES - 2))"
Related Question