1WATCH(1)                         User Commands                        WATCH(1)
2
3
4

NAME

6       watch - execute a program periodically, showing output fullscreen
7

SYNOPSIS

9       watch [options] command
10

DESCRIPTION

12       watch  runs  command  repeatedly, displaying its output and errors (the
13       first screenfull).  This allows you to watch the program output  change
14       over  time.   By default, command is run every 2 seconds and watch will
15       run until interrupted.
16

OPTIONS

18       -d, --differences[=permanent]
19              Highlight the differences between successive updates. If the op‐
20              tional  permanent argument is specified then watch will show all
21              changes since the first iteration.
22
23       -n, --interval seconds
24              Specify update interval.  The command  will  not  allow  quicker
25              than  0.1  second interval, in which the smaller values are con‐
26              verted. Both '.' and ',' work for any locales. The  WATCH_INTER‐
27              VAL  environment  can  be used to persistently set a non-default
28              interval (following the same rules and formatting).
29
30       -p, --precise
31              Make watch attempt to run command every --interval seconds.  Try
32              it  with ntptime (if present) and notice how the fractional sec‐
33              onds stays (nearly) the same, as opposed to  normal  mode  where
34              they continuously increase.
35
36       -t, --no-title
37              Turn  off  the header showing the interval, command, and current
38              time at the top of the display, as well as the  following  blank
39              line.
40
41       -b, --beep
42              Beep if command has a non-zero exit.
43
44       -e, --errexit
45              Freeze updates on command error, and exit after a key press.
46
47       -g, --chgexit
48              Exit when the output of command changes.
49
50       -c, --color
51              Interpret ANSI color and style sequences.
52
53       -x, --exec
54              Pass  command to exec(2) instead of sh -c which reduces the need
55              to use extra quoting to get the desired effect.
56
57       -w, --no-linewrap
58              Turn off line wrapping. Long lines will be truncated instead  of
59              wrapped to the next line.
60
61       -h, --help
62              Display help text and exit.
63
64       -v, --version
65              Display version information and exit.
66

EXIT STATUS

68              0      Success.
69              1      Various failures.
70              2      Forking the process to watch failed.
71              3      Replacing  child  process  stdout  with  write  side pipe
72                     failed.
73              4      Command execution failed.
74              5      Closing child process write pipe failed.
75              7      IPC pipe creation failed.
76              8      Getting  child  process  return  value  with   waitpid(2)
77                     failed, or command exited up on error.
78              other  The  watch  will  propagate  command exit status as child
79                     exit status.

ENVIRONMENT

81       The behaviour of watch is affected by the following  environment  vari‐
82       ables.
83
84       WATCH_INTERVAL
85              Update  interval,  follows the same rules as the --interval com‐
86              mand line option.

NOTES

88       POSIX option processing is used (i.e., option processing stops  at  the
89       first  non-option argument).  This means that flags after command don't
90       get interpreted by watch itself.

BUGS

92       Upon terminal resize, the screen will not be correctly repainted  until
93       the  next  scheduled update.  All --differences highlighting is lost on
94       that update as well.
95
96       Non-printing characters are stripped from program output.  Use  cat  -v
97       as part of the command pipeline if you want to see them.
98
99       Combining  Characters  that are supposed to display on the character at
100       the last column on the screen may display one column early, or they may
101       not display at all.
102
103       Combining  Characters  never  count as different in --differences mode.
104       Only the base character counts.
105
106       Blank lines directly after a line which ends in the last column do  not
107       display.
108
109       --precise mode doesn't yet have advanced temporal distortion technology
110       to compensate for a command that takes more than --interval seconds  to
111       execute.   watch also can get into a state where it rapid-fires as many
112       executions of command as it can to catch up from a previous  executions
113       running  longer  than --interval (for example, netstat taking ages on a
114       DNS lookup).

EXAMPLES

116       To watch for mail, you might do
117              watch -n 60 from
118       To watch the contents of a directory change, you could use
119              watch -d ls -l
120       If you're only interested in files owned by user joe, you might use
121              watch -d 'ls -l | fgrep joe'
122       To see the effects of quoting, try these out
123              watch echo $$
124              watch echo '$$'
125              watch echo "'"'$$'"'"
126       To see the effect of precision time keeping, try adding -p to
127              watch -n 10 sleep 1
128       You can watch for your administrator to install the latest kernel with
129              watch uname -r
130       (Note that -p isn't guaranteed to work across  reboots,  especially  in
131       the  face  of ntpdate (if present) or other bootup time-changing mecha‐
132       nisms)
133
134
135
136procps-ng                         2020-12-06                          WATCH(1)
Impressum