I Like to Watch
January 24th, 2009[ Linux ]
In the category of lovely commands you may not know about, the watch command. You can take almost any command and throw watch in front and it will recurse for you. A quick example: You’re copying or ftping a large amount of files into /tmp directory and you want to keep an eye on the progress. Let’s say you’re also interested in file details so this will give you a snapshot:
ls -lh /tmp
To keep an eye on it, just prefix with watch:
watch ls -lh /tmp
Default is to rerun every 2 seconds which is a bit much for this. The following will run every 30 seconds allowing me to keep a watch on progress:
watch -n 30 ls -lh /tmp