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 ifcommandexits 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 optionalpermanentargument,watchshows you all the changes since the very first iteration. thepermanentargument needs to be linked to the option, like-d1or--differences=1. can't just float around on its own bestie-e,--errexitโ freeze the updates whencommanderrors out, and exit after you press a key. the exit code ofwatchwill be the codecommandexits with. and if signal n is what killedcommand, the exit code will be 128 + n. dramatic exit, love that for her ๐-f,--followโ instead of clearing the screen on every update,watchscrolls the output, kinda like howtail -fworks. โ ๏ธ this option is not compatible with any option that tracks the output of the screen, such as the--differences,--chgexitand--eqexitoptions. pick a lane girl-g,--chgexitโ exit when the visible output ofcommandchanges. heads up: changes that are off the screen because your screen is small or the output is huge will not causewatchto exit-n,--intervalseconds โ set the update interval. values smaller than0.1and larger than2678400(that's 31 days, wild) get converted into those respective bounds. both.and,work for any locale. and theWATCH_INTERVALenvironment variable can persistently set a non-default interval (following the same rules and formatting) ๐ซถ-p,--preciseโ executecommand--intervalseconds after its previous run started, instead of--intervalseconds after its previous run finished. if it's taking longer than--intervalseconds forcommandto complete, it is waited for in either case. she's punctual ๐-q,--equexitcycles โ exit when the output ofcommanddoes 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โ passcommandto anexec(3)call instead ofsh -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
commandimmediately. 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 theSIGKILLfollowing Ctrl+C) ๐ - s โ take a screenshot. it'll be saved in the working directory, unless specified otherwise by
--shotsdir. ifcommandis running at the moment, the screenshot gets taken as soon as it finishes โญ
๐ EXIT STATUS ๐
- 0 โ Success. does not represent the
commandexit code - 1 โ Errors unrelated to
commandoperation - 2 โ Errors related to
commandexecution and management (not its exit code) - any non-zero (
--errexit) โ with--errexitthe last exit code ofcommandis returned
๐ฆ ENVIRONMENT ๐ฆ
the behavior of watch is affected by the following environment variables:
WATCH_INTERVALโ update interval, follows the same rules as the--intervalcommand line optionCOLUMNSโ terminal screen character width. set it to override autodetectionLINESโ 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
- Copyright (c) 2023 Roman ลฝilka <roman.zilka@gmail.com>
- Copyright (c) 2009-2025 Craig Small <csmall@dropbear.xyz>
- Copyright (c) 2018-2023 Jim Warner <james.warner@comcast.net>
- Copyright (c) 2011-2012 Sami Kerola <kerolasa@iki.fi>
- Copyright (c) 2003 Albert Cahalan
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms