watch
Execute a command periodically and display output
TLDR
Repeatedly run a command and show the result
Re-run a command every 60 seconds
Monitor disk space, highlighting differences as they appear
Repeatedly run a pipeline and show the result
Exit watch if the visible output changes
Interpret terminal control characters
SYNOPSIS
watch [options] command
PARAMETERS
-n, --interval
Specify update interval in seconds. The command is executed every
-d, --differences[=
Highlight the differences between successive updates. permanent makes highlight permanent.
-t, --no-title
Turn off showing the header at the top of the display.
-h, --help
Display help text and exit.
-v, --version
Display version information and exit.
-x, --exec
Pass command to sh -c which expands variables. This is needed for commands such as watch ls ${DIR}.
-e, --errexit
Exit if the command has a non-zero exit status.
-b, --beep
Beep if the command has a non-zero exit status.
DESCRIPTION
The watch command in Linux executes a specified program at regular intervals and displays its output on the terminal. It's invaluable for monitoring system resources, log files, or any command whose output changes over time. By default, watch updates the display every 2 seconds, but this interval can be adjusted. The command highlights the differences between successive executions, making it easy to spot changes. The watch command is particularly useful for system administrators and developers who need to keep a close eye on system activity. It provides a simple way to track changes without manually re-running commands. It is easy to use and offers a simple way to view dynamic processes or log file changes. You can configure many options such as the interval time or even if the changes are highlighted or not. It is very useful for tracking changes as they occur in real-time, providing immediate visibility into the evolving state of the system.
INTERRUPTING WATCH
To stop the watch command, press Ctrl+C.
HIGHLIGHTING NUANCES
The -d option with the =permanent argument makes the highlight stay on the screen and doesn't reset itself with new changes.
HISTORY
The watch command has been a part of Unix-like systems for a long time, providing a simple and effective way to monitor changes in system processes and outputs. It's a staple in system administration and development environments.