We might need to continuously watch the output of a command for a period of time in equal intervals. For example, for a large file copy, we need to watch the growing file size. In order to do that, newbies repeatedly type commands and press return a number of times. Instead we can use the watch command to view output repeatedly. This recipe explains how to do that.
watch command can be used to monitor the output of a command on the terminal at regular intervals. The syntax of the
watch command is as follows:
$ watch COMMAND
$ watch ls
$ watch 'COMMANDS'
$ watch 'ls -l | grep "^d"' # list only directories
This command will update the output at a default interval ...