watch - observing an application's output in real time

Monitor an application's output with the watch command: periodically track processes and changes in real time. Learn the most useful options.

The watch command periodically calls the process we're interested in. It displays the output of this process in full screen, by default every 2 seconds, which gives us the impression of an application running continuously.

watch [options] command

  • Options:
  • -n: change the interval at which the process is called
  • -d: highlight changes (highlights differences between successive calls)
  • -d=cumulative: keep highlighted changes
  • -t: disables displaying the header

Usage examples:

  • watch free - monitors memory usage
  • watch lsof -i - monitors all connections
  • watch 'lsof -i | grep LISTEN' - monitors all established connections

In the last example, quotes were used because we're using pipe processing.