WATCH(1)

๐Ÿ‘‘ WATCH(1) โ€” the girlies' guide to watch

okay bestie so this is watch, straight out of the General Commands Manual, and honestly? she's iconic. let's get into it ๐Ÿ’…


โœจ NAME โœจ

watch โ€” run a program on repeat and show its output fullscreen ๐ŸŒˆ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

watch [option ...] command

๐Ÿ’– DESCRIPTION ๐Ÿ’–

so watch literally runs your command over and over, showing you its output and errors (the first screenful of it). the whole point is you get to sit there and watch the program's output change over time like it's a livestream. by default command gets run every 2 seconds and watch just keeps going until you interrupt it. there's a header up top telling you when command started, how long it's been running, and its exit code. chef's kiss ๐ŸŽ€


โœจ OPTIONS โœจ

  • -b, --beep โ€” beep if command exits with a non-zero status. it's giving alarm clock โฐ
  • -c, --color โ€” interpret ANSI color and style sequences. let her be colorful ๐Ÿฆ‹
  • -C, --no-color โ€” do not interpret ANSI color and style sequences. muted mode, no cap
  • -d, --differences[=permanent] โ€” highlight what changed between successive updates. if you pass the optional permanent argument, watch shows you all the changes since the very first iteration. the permanent argument needs to be linked to the option, like -d1 or --differences=1. can't just float around on its own bestie
  • -e, --errexit โ€” freeze the updates when command errors out, and exit after you press a key. the exit code of watch will be the code command exits with. and if signal n is what killed command, the exit code will be 128 + n. dramatic exit, love that for her ๐Ÿ’€
  • -f, --follow โ€” instead of clearing the screen on every update, watch scrolls the output, kinda like how tail -f works. โš ๏ธ this option is not compatible with any option that tracks the output of the screen, such as the --differences, --chgexit and --eqexit options. pick a lane girl
  • -g, --chgexit โ€” exit when the visible output of command changes. heads up: changes that are off the screen because your screen is small or the output is huge will not cause watch to exit
  • -n, --interval seconds โ€” set the update interval. values smaller than 0.1 and larger than 2678400 (that's 31 days, wild) get converted into those respective bounds. both . and , work for any locale. and the WATCH_INTERVAL environment variable can persistently set a non-default interval (following the same rules and formatting) ๐Ÿซถ
  • -p, --precise โ€” execute command --interval seconds after its previous run started, instead of --interval seconds after its previous run finished. if it's taking longer than --interval seconds for command to complete, it is waited for in either case. she's punctual ๐Ÿ’…
  • -q, --equexit cycles โ€” exit when the output of command does not change for the given number of cycles
  • -r, --no-rerun โ€” do not run the program on terminal resize; the output of the program will re-appear at the next regular run time
  • -s, --shotsdir โ€” directory to save screenshots into ๐Ÿ“ธ
  • -t, --no-title โ€” turn off the header that's normally shown at the top of the screen
  • -w, --no-wrap โ€” turn off line wrapping. long lines get truncated instead of wrapped to the next line
  • -x, --exec โ€” pass command to an exec(3) call instead of sh -c. the program will start a bit quicker, but shell features (environment setup, variable and pathname expansion, etc.) will be unavailable. trade-off city ๐Ÿ˜ญ
  • -h, --help โ€” display help text and exit
  • -v, --version โ€” display version information and exit

๐ŸŽ€ KEY CONTROL ๐ŸŽ€

  • spacebar โ€” issue command immediately. if it's running at the moment, it is not interrupted, and its next round will start without delay. impatient queen behavior, valid
  • q โ€” quit watch. heads up: it currently does not interrupt a running command (unlike terminating signals, such as the SIGKILL following Ctrl+C) ๐Ÿ›‘
  • s โ€” take a screenshot. it'll be saved in the working directory, unless specified otherwise by --shotsdir. if command is running at the moment, the screenshot gets taken as soon as it finishes โญ

๐ŸŒˆ EXIT STATUS ๐ŸŒˆ

  • 0 โ€” Success. does not represent the command exit code
  • 1 โ€” Errors unrelated to command operation
  • 2 โ€” Errors related to command execution and management (not its exit code)
  • any non-zero (--errexit) โ€” with --errexit the last exit code of command is returned

๐Ÿฆ‹ ENVIRONMENT ๐Ÿฆ‹

the behavior of watch is affected by the following environment variables:

  • WATCH_INTERVAL โ€” update interval, follows the same rules as the --interval command line option
  • COLUMNS โ€” terminal screen character width. set it to override autodetection
  • LINES โ€” terminal screen character height. set it to override autodetection

๐Ÿ’œ NOTES ๐Ÿ’œ

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

non-printing characters are stripped from program output. use cat -v as part of the command pipeline if you want to see them. ๐Ÿ™ˆ


๐Ÿ”ฅ EXAMPLES ๐Ÿ”ฅ

to watch the contents of a directory change, you could use

watch -d ls -l

if you have CPUs with a dynamic frequency and want to observe it change, try the following. the command is passed to the shell, which allows you to make the pipeline. the quotes are a feature of the shell too.

watch -n1 'grep "^cpu MHz" /proc/cpuinfo | sort -nrk4'

to monitor the up status of your servers, saving a copy of the output of each run to a file, you may use this. the -p makes the command execute every 10 seconds regardless of how long it took to complete the previous run.

watch -n10 -p -d '{ date; for i in 10.0.0.31 10.0.0.32 10.0.0.33;
do R=OK; ping -c2 -W2 "$i" &>/dev/null || R=FAIL; echo "$i: $R";
done } | tee -a ~/log'

you can watch for your administrator to install the latest kernel with

watch uname -r

๐Ÿ’€ BUGS ๐Ÿ’€

when the terminal dimensions change, its contents changes are not registered on the next command run. --chgexit will not trigger that turn, and the counter of --equexit will not restart even if command output changes meanwhile. --differences highlighting is reset. yeah... she's got a little quirk, we still love her ๐ŸŒธ


๐Ÿ“ฌ REPORTING BUGS ๐Ÿ“ฌ

please send bug reports to procps@freelists.org. tell them the group chat sent you ๐Ÿ’Œ


and that's the whole vibe bestie โ€” this was procps-ng, dated 2025-04-16, and watch(1) ate and left no crumbs. go watch something, you got this ๐Ÿ‘‘๐Ÿ’–

๐Ÿ“ฆ where this page comes from
  • arch rolling: procps-ng 4.0.7-1 ยท GPL AND LGPL
  • nixpkgs unstable: procps 4.0.7
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms