Linux Watch Command
Watch Command is used to run commands at regular intervals like 10 sec,1 mins, etc . This is alternate to cron command.
Where:
[option]: Adding an option changes the way thewatchcommand behaves. Available options are listed below.[command]: A user-defined command you want to run repeatedly.
The watch command options include:
-n, --interval | Allows you to specify the interval between output updates. |
-d, --differences | Highlights the differences between output updates. |
-g, --chgexit | Exits the watch command when the output of the user-defined command changes. |
-t, --no-title | Removes the header showing the interval, command, and current time and date. |
-b, --beep | Plays a sound alert (beep) if the command exits with an error. |
-p, --precise | Attempts to run the command after the exact number of seconds defined by the --interval option. |
-e, --errexit | Stops output updates on error and exits the command after a key press. |
-c, --color | Interprets ANSI color and style sequences. |
-x, --exec | Passes the user-defined command to exec, reducing the need for extra quoting. |
-w, --no-linewrap | Turns off line wrapping and truncates long lines instead. |
-h, --help | Displays help text and exits. |
-v, --version | Displays version information and exits. |
Linux Watch Command Examples
Here are some of the ways you can use the watch command options to achieve different results:
Run Command with a Custom Interval
Set a custom interval to run a user-defined command and show the output by using the -n or --interval option:
For instance, to display the system time and date every 5 seconds, run:

For ORACLE DBA
watch -n 30 dcli -l root -g /u01/onecommand/dbs_group uptime
Note: Above Command will run for every 30 sec
To highlight the difference between previous and current output
watch -n 5 -d date