The Watch Command

The Watch Command

The watch command is used when you want to have a program run every so many seconds that you define. I often use it to see the stream of files that are being transferred or for checking the status of scripts while I test them.

Running The Watch Command

Here is a common way that I use watch after I have run rsync just to make sure things are going the way they should:

$ watch -n2 ls -la
or
$ watch -n2 -du -h
or 
$ watch -n2 -df -h

The default timer is 2 seconds. So I could also done the command without the ‘-n2’.

Jokes

Watches shouldn’t be called watches anymore. No one watches them anymore. They are mostly glanced at. They really should be called glances.

META: using a Linux watch and running the watch command is extremely meta!!!