watch
Processes and system
Usage
watch -n <seconds> "<command>"Reruns the same command every few seconds and redraws the screen; quote anything with a pipe or a `*` in it, or the shell applies it once to watch itself, and macOS does not ship it.
Common flags
| Flag | Meaning |
|---|---|
| -n 5 | Interval in seconds; the default is 2. |
| -d | Highlight what changed since the last run. |
| -t | Drop the header line. |
| -g | Exit as soon as the output changes. |
| -x | Run the command directly instead of through a shell. |
Examples
watch -n 5 "kubectl get pods"Quote it, or the shell hands watch only the first word.
watch -d free -hWatch memory move, with the changes highlighted.
What is running and what is eating the machine. Identifying it comes before killing it.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does watch do?
Reruns the same command every few seconds and redraws the screen; quote anything with a pipe or a `*` in it, or the shell applies it once to watch itself, and macOS does not ship it.
Q. How do I type it?
watch -n <seconds> "<command>" — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
5 are listed here; the full set is in man watch. This command sits under Processes and system.
Related commands
man page: man watch