(Linux) Runs some other command at regular intervals and shows you the result. Useful for when you are constantly checking on something like diskpace, the size of a file, some network connection: whatever, it really doesn't matter. Just run "watch" with your command , enclosing it in quotes if you are using pipes:
watch 'ps aux | grep myprocess'
The default is to run your command every two seconds, which is usually way too soon. There's a handy -d flag that highlights differences from the last run. You may want to add -c to that if your really need to notice a change whether or not you happened to be looking when it happened.
Finally, "watch" only displays the first screenful of output.
# watch logins every 10 seconds, marking changes cumulatively watch -n 10 -dc w
If you found something useful today, please consider a small donation.
Got something to add? Send me email.
More Articles by Tony Lawrence © 2011-07-05 Tony Lawrence