NAME
watchdiff - repeat command and watch differences
VERSION
Version 4.49
SYNOPSIS
watchdiff option -- command
OPTIONS:
-r, --refresh:1 refresh screen count (default 1)
-i, --interval=i interval time in second (default 2)
-c, --count=i command repeat count (default 1000)
-e, --exec=s set executing commands
-s, --silent do not show same result
-p, --plain shortcut for --nodate --nonewline
--[no-]date show date at the beginning (default on)
--[no-]newline print newline after result (default on)
--[no-]clear clear screen after output (default on)
--diff=command diff command used to compare result
--unit=unit comparison unit (word/letter/char/mecab)
-V, --verbose print diff control command (default off)
-M, --mark show diff mark (default off)
-O, --old show old data (default off)
-C[#],--context=# diff before/after context (default 2)
-S, --scroll set scroll region (default on)
-h, --help show help
--version show version
DESCRIPTION
watchdiff repeatedly executes the given command and shows how its output changes, highlighting the difference from the previous run. Use ^C to terminate.
The command basically expects the output to be small enough to fit on the terminal screen. If the output is taller than the screen, only the final part is shown.
Use the -C# option if the output is large and you want to see only the modified part.
OPTIONS
What to run
- -e command, --exec=command
-
Set the command to execute. The option can be repeated; the output of all the commands is joined together and compared as a whole.
watchdiff -e uptime -e iostat -e dfThe command can also be written after the options. Put
--in front of it if it takes options of its own. - -c count, --count=count
-
Repeat the command count times, then exit. Default is 1000.
- -i second, --interval=second
-
Wait second seconds between executions. Default is 2.
How the screen is used
- -r[count], --refresh[=count]
-
Clear the screen every count executions, so the result stays at the top of the screen. Default is 1, clearing every time. With
-r0the screen is never cleared and the results simply scroll by. - --[no-]clear
-
Erase the rest of the screen after the result is printed, so that a longer result from an earlier round does not stay behind. Effective only while refreshing. Default on.
- -S, --[no-]scroll
-
Set the scroll area from the third line of the screen to the bottom edge, leaving the date header in place. This takes effect only when the date is shown and the screen is refreshed every time. Default on.
- -s, --[no-]silent
-
While the result does not change, do not print it again; only the date is updated in place. Default off.
- --[no-]date
-
Print the date in front of each result. Default on.
- --[no-]newline
-
Print a newline after the result. Default on.
- -p, --plain
-
Shortcut for --no-date --no-newline.
How the difference is shown
- -C[context], --context=context, -Ucontext
-
Show context lines before and after the updated part, instead of the whole result. Bare -C means 2. Any context under 100 also turns on the --verbose option; use --no-verbose to keep it off.
- -V, --[no-]verbose
-
Print the control lines of the diff output. Default off.
- -M, --[no-]mark
-
Print the diff mark at the head of each line. Default off.
- -O, --[no-]old
-
Print the old text as well as the new one. Default off.
- --unit=unit, --by=unit
-
Set the unit of comparison, passed through to cdif. Choose from
word(default),letter,charormecab. - --cm=colormap, --colormap=colormap
-
Set the colors used for the difference. The labels are
APPEND,DELETE,OCHANGE,NCHANGE,OTEXTandNTEXT, and the values are handed to cdif. See "--colormap" in cdif for the format. - --diff=command
-
Compare the two results with command instead of the built-in cdif call. The command is given the two file names as its last two arguments. Note that the options above that are implemented by passing something to cdif have no effect once this is set.
watchdiff -ps --diff=sdif netstat -sp ip
Others
EXAMPLES
watchdiff df
watchdiff --silent df
watchdiff --refresh 5 --noclear df
watchdiff ifconfig en0
watchdiff -sri1 -- netstat -sp ip
watchdiff -ps --diff=sdif netstat -sp ip
watchdiff -e uptime -e iostat -e df
watchdiff -pc18i10r0 date; say -v Alex Ramen is ready
watchdiff -sU2 du -h ~/Music
AUTHOR
Kazumasa Utashiro
https://github.com/kaz-utashiro/sdif-tools
LICENSE
Copyright 2014-2026 Kazumasa Utashiro
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.