Javatpoint Logo
Javatpoint Logo

Linux Watch Command

In Linux, we use the watch command in order to execute the program at regular intervals, displaying output in Fullscreen. Watch command can run the definite command in the parameter constantly by displaying its output and errors. By default, in every 2 seconds, the specified command run, and the watch will run till interrupted.

Watch command is helpful if we need to execute the command continually and watch the output of the command change periodically. For example, the watch command can be used to monitor the system uptime and disk usage. Watch is pre-installed in almost every Linux distribution, and it is a part of the procps package.

How to Use Watch Command

If we want to use the watch command, then we have to follow the following syntax:

In order to understand how the watch command operates, we run the date command:

Linux Watch Command

In the above image, we can see that the watch command will remove all the terminal content temporarily and begin running the given command periodically. If we use with no option, then the watch will run the specified command every two seconds.

We can see the watch update interval and the executed command, which is every 2.0s: date, at the top left of the screen header, while the clock at the top left watch displays the current date and time. If we need to stop using the header, we have to use the option -t (--no-title).

The specified command's output is shown on the screen and repeatedly updated in every two seconds.

We have to enter the Ctrl+C key if we want to exit out of the watch command.


  • -d, -differences

We use this option to highlight the modification between two successive updates. The -d, -difference option read the alternative argument that makes the modification permanent, permitting the user to see what has been modified slightly once since the first iteration.


Linux Watch Command
  • -n, -interval seconds

We use this option to determine the update interval. This command is not quicker to allow than 0.1 second interval, with the smaller values being changed.


Linux Watch Command
  • -p, -precise

Using this option, watch attempt to run the command every interval seconds.


Linux Watch Command
  • -t, -no-title

With the help of this option, the header can turn off, which displays the command, current time, and interval at the screen's top.

Linux Watch Command
  • -b, -beep

If the command has a non-zero exit, then this option will give a beep.


Linux Watch Command
  • -e, -errexit

The -e, -errexit option freezes the updates on command error and then exit after a key press.

Linux Watch Command
  • -g, -chgexit

The -g, -chgexit option exit if the command's output exit.

  • -c, -color

The -c, -color option interprets the style sequences and ANSI color.

  • -x, -exec

This option is given to the sh -c that means we may need to use additional quoting in order to get the desired effect.

  • Watch -h

The watch -h option is used to display the help message and exit.


Linux Watch Command
  • Watch -v

The watch -v option will show the information of the version and exit.


Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA