watchのヘルプ・マニュアル
日本語 英語
watch --help
man watch
WATCH(1) Linux User’s Manual WATCH(1)
名前
watch - プログラムを定期的に実行し、出力をフルスクリーンで表示する
書式
watch [-dhvt] [-n ] [--differences[=cumulative]] [--help]
[--interval=] [--no-title] [--version]
説明
watch は command を繰り返し実行し、その出力を表示する (一画面に収まる一
杯 まで)。 watch を用いると、プログラムの出力の経時変化を監視できる。デ
フォルトでは、プログラムは 2 秒おきに起動される。時間の間隔を変えたい場
合は、 -n または --interval を用いる。
-d または --differnces フラグを指定すると、更新が行われたとき、前回と異
なっている部分をハイライト表示する。 cumulative オプションをつけると 、
ハ イライトが "sticky" になる。すなわち、実行が開始されてから変更があっ
た全ての部分をハイライトで表示する。 -t または --no-title オプション を
指 定すると、画面の先頭行に時間間隔・コマンド名・現在時刻を示すヘッダが
表示されず、その後の空行も表示されない。
watch は中断されるまで実行を続ける。
注意
command は "sh -c" に与えられる。したがって command を望みの通りに動 作
させるには、クォートを余分に用いる必要があるかもしれない。
POSIX のオプション処理が用いられる (つまり、オプション処理は最初にオプ
ション以外の引数が現れた時点で終了する) ことに注意して欲しい。つまり 、
command 以降のフラグは watch によっては解釈されない。
例
メールを監視する:
watch -n 60 from
ディレクトリの中身の変化を監視する:
watch -d ls -l
ユーザー joe の所有するファイルのみを監視する:
watch -d ’ls -l | fgrep joe’
クォートの効果を見てみたい場合:
watch echo $$
watch echo ’$$’
watch echo "’"’$$’"’"
管理者による最新のカーネルのインストール状況を監視する:
watch uname -r
(ただの冗談です)
バグ
端 末のリサイズ時に、スクリーンは正しく再描画されない。次の更新スケジュ
ールを待たなければならない。 --differences によるハイライト表示は、その
更新の際に全て失われる。
非 印字文字はプログラム出力から取り除かれる。これらをみたい場合は、コマ
ンドのパイプラインのどこかで "cat -v" を用いること。
著者
もともとの watch は Tony Rems が 1991 に書 い た 。
Francois Pinard が修正・変更を行った。 Mike Coleman が
1999 に書き直し、新しい機能を追加した。
1999 Apr 3 WATCH(1)
WATCH(1) Linux User’s Manual WATCH(1)
NAME
watch - execute a program periodically, showing output fullscreen
SYNOPSIS
watch [-dhvt] [-n ] [--differences[=cumulative]] [--help]
[--interval=] [--no-title] [--version]
DESCRIPTION
watch runs command repeatedly, displaying its output (the first screen-
full). This allows you to watch the program output change over time.
By default, the program is run every 2 seconds; use -n or --interval to
specify a different interval.
The -d or --differences flag will highlight the differences between
successive updates. The --cumulative option makes highlighting
"sticky", presenting a running display of all positions that have ever
changed. The -t or --no-title 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.
watch will run until interrupted.
NOTE
Note that command is given to "sh -c" which means that you may need to
use extra quoting to get the desired effect.
Note that POSIX option processing is used (i.e., option processing
stops at the first non-option argument). This means that flags after
command don’t get interpreted by watch itself.
EXAMPLES
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 "’"’$$’"’"
You can watch for your administrator to install the latest kernel with
watch uname -r
(Just kidding.)
BUGS
Upon terminal resize, the screen will not be correctly repainted until
the next scheduled update. All --differences 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.
AUTHORS
The original watch was written by Tony Rems in
1991, with mods and corrections by Francois Pinard. It was reworked
and new features added by Mike Coleman in 1999.
1999 Apr 3 WATCH(1)