watch(1)
Thursday, August 08, 2002 @ 10.12 CDT

My new favorite Linux command is watch(1).

Forever, I've used something like this shell loop on Unix systems to check something periodically, say the progress of a slow transfer of many files to a directory:

while :
do
    clear
    date
    echo ---
    ls -ltr | tail -5
    sleep 10
done

But watch makes it as simple as:

watch -n10 "ls -ltr | tail -5"

And though I've used Linux for five years or so, I'd never known it was there.

This is a common thing in my experience with Linux; you can do most things in your old Unix-y way, but it has hundreds of small shortcuts and improvements that make life better.

All the news