May 2013
Beginner to intermediate
384 pages
7h 40m
English
We might need to continuously watch the output of a command for a period of time in equal intervals. For example, while copying a large file, we might need to watch the growth of the file size. In order to do that, we can use the watch command to execute the du command and output repeatedly. This recipe explains how to do that.
The 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
For example:
$ watch ls
Or
$ watch 'COMMANDS'
For example:
$ watch 'ls -l | grep "^d"' # list only directories
This command will update the output at a default interval of two seconds.
We can also specify the ...
Read now
Unlock full access