Man page of WATCH
Section: Linux User's Manual (1)
Updated: 2009 May 11
Return to Main Contents
watch - execute a program periodically, showing output fullscreen
repeatedly, displaying its output and errors (the first screenfull). This
allows you to
watch the program output change over time. By default, the program is run
every 2 seconds; use
to specify a different interval. Normally, this interval is interpreted
as the amout of time between the completion of one run of
and the beginning of the next run. However, with the
option, you can make
attempt to run
seconds. Try it with
and notice how the fractional seconds stays
(nearly) the same, as opposed to normal mode where they continuously
flag will highlight the differences between successive updates. Using
makes highlighting "sticky", presenting a running display of all
positions that have ever changed. The
option turns off the header showing the interval, command, and current
time at the top of the display, as well as the following blank line. The
option causes the command to beep if it has a non-zero exit.
will normally run until interrupted. If you want
to exit on an error from the program running use the
options, which will cause
to exit if the return value from the program is non-zero.
is given to "sh -c"
which means that you may need to use extra quoting to get the desired effect.
You can disable this with the
option, which passes the command to exec(2) instead.
Note that POSIX option processing is used (i.e., option processing stops at
the first non-option argument). This means that flags after
don't get interpreted by
To watch for mail, you might do
watch -n 60 from
To watch the contents of a directory change, you could use
watch -d ls -l
If you're only interested in files owned by user joe, you might use
watch -d 'ls -l | fgrep joe'
To see the effects of quoting, try these out
watch echo $$
watch echo '$$'
watch echo "'"'$$'"'"
To see the effect of precision time keeping, try adding
watch -n 10 sleep 1
You can watch for your administrator to install the latest kernel with
watch uname -r
isn't guaranteed to work across reboots, especially in the face of
or other bootup time-changing mechanisms)
Upon terminal resize, the screen will not be correctly repainted until the
next scheduled update. All
highlighting is lost on that update as well.
Non-printing characters are stripped from program output. Use "cat -v" as
part of the command pipeline if you want to see them.
mode doesn't yet have advanced temporal distortion technology to
compensate for a
that takes more than
seconds to execute.
also can get into a state where it rapid-fires as many executions of
as it can to catch up from a previous executions running longer than
taking ages on a DNS lookup).
was written by Tony Rems <[email protected]> in 1991, with mods and
corrections by Francois Pinard. It was reworked and new features added by
Mike Coleman <[email protected]> in 1999. The beep, exec, and error handling
features were added by Morty Abzug <[email protected]> in 2008.
On a not so dark and stormy morning
in March of 2003, Anthony DeRobertis <[email protected]> got sick of
his watches that should update every minute eventually updating many
seconds after the minute started, and added microsecond precision.
This document was created by
using the manual pages.
Time: 03:41:18 GMT, September 24, 2010