Search notes:

Shell command: watch

watch executes a command/program repeatedly in regular intervals and prints the program's output. This is especially useful to find quickly find out if the output is changing over time.
watch [options] command

Options

-b --beep Beep if command has a non-zero exit.
-c --color Interpret ANSI color and style sequences.
-C --no-color Do not interpret ANSI color and style sequences.
-d --differences [=permanent] Highlight the differences between successive updates. If the optional permanent argument is specified then watch will show all changes since the first iteration.
-e --errexit Freeze updates on command error, and exit after a key press.
-g --chgexit Exit when the output of command changes.
-n --interval n Specify update interval in seconds. n can be fractional, but must be greater than 0.1. Both . and , work for any locales. The WATCH_INTERVAL environment varible can be used to persistently set a non-default interval (following the same rules and formatting).
-p --precise Make watch attempt to run command every --interval seconds. Try it with ntptime (if present) and notice how the fractional seconds stays (nearly) the same, as opposed to normal mode where they continuously increase.
-q --equexit <cycles> Exit when output of command does not change for the given number of cycles.
-r --no-return Do not run the program on terminal resize, the output of the program will re-appear at the next regular run time.
-t --no-title Turn off the header showing the interval, command, and current time at the top of the display, as well as the following blank line.
-w --no-wrap Turn off line wrapping. Long lines will be truncated instead of wrapped to the next line.
-x --exec Pass command to exec(2) instead of sh -c which reduces the need to use extra quoting to get the desired effect.
-h --help Display help text and exit.
-v --version Display version information and exit.

Examples

The following command specifies the interval to be one seconed: every second, an updated date is printed:
$ watch --interval=1 date
The --difference option highlights the changes between the output of the last two executions:
$ watch --interval=1 --differences ntptime

See also

The SQLcl command repeat.
Shell commands

Index