09-10-2023, 09:08 AM
Linux watch Command Syntax
The watch command syntax looks like this:
watch [options]
For example, a watch command combined with the free command would look like this:

The specified command shows that the watch command clears the terminal window and runs the free command every two seconds. You can find the list of most commonly used watch command options below:
| Option | Explanation |
|---|---|
| -d, --differences | Displays the differences between watch command updates. If you want all changed values to stay highlighted, use the combined -d=cumulative option. |
| -t, --no-title | Turns off the header that displays the time interval, command, current time and date, and hostname. |
| -n, --interval | Allows users to specify the time interval between output updates in seconds. |
| -b, --beep | Plays a beep whenever a command exits with an error. |
| -g, --chgexit | Exits the watch command when the user command output changes. |
| -e, --errexit | Halts watch command updates on screen when an error occurs and exits the command after a key press. |
| -h, --help | Displays the help page. |
| -c, --color | Interprets ANSI color and style sequences. |
| -x, --exec | Forwards user command to exec. |
| -p, --precise | Tries to run the user-defined command exactly after seconds defined by the --interval option. |

