Monitor Command Output with watch -d
watch re-runs a command on an interval and -d highlights differences between refreshes — a poor man's live dashboard.
Run `watch -d -n 2 free -h` to refresh memory usage every 2 seconds with changes highlighted; press Ctrl+C or q to quit.
01Command
Command
$ watch -d -n 2 free -h02What it does
watch takes over the terminal, clears it, and reruns the given command at the -n interval (default 2 seconds), which turns any one-shot command into a live monitor. The -d flag highlights what changed since the last refresh, and -d=cumulative keeps highlighting everything that has ever changed. Quote carefully: the whole pipeline must be passed to watch, e.g. `watch -n 5 'df -h / | tail -1'`.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- watch(1) - execute a program periodicallyEvidence: watch runs command repeatedly, showing its output and errors; -d, --differences highlights the changes; -n, --interval seconds specifies the update interval.
Last verified: 2026-09-17 · Category: System & Settings