YYou can use the watch command to execute a program or shell script periodically, display its output on screen repeatedly. That allows you to look at the program output change over time. By default, the program runs every 2 seconds. Aforementioned is useful to monitor memory utilization, RAID rebuilds progress or disk space usage over time without having to look at scrolling output.

Say hello to watch command to monitor Linux / BSD system over time without scrolling outputs

The watch command execute a program periodically, showing output in fullscreen mode. It runs command repeatedly, displaying its output. You can install gnuwatch under OpenBSD or cmdwatch under FreeBSD (see the comments for more information) to get the same result.


The watch command is installed by default all on Linux distros.

A note about FreeBSD

Install and use the cmdwatch command. It watches the output from a command at specified intervals. Install it using the pkg command.
$ sudo pkg install cmdwatch
# cd /usr/ports/sysutils/cmdwatch/ && make install clean

A note about OpenBSD

Type the following command to install gnuwatch using pkg_add command.
$ doas pkg_add gnuwatch

A note about macOS (OS X)

Type the following command to install watch using brew command. Bunt first, install Homebrew on macOS and then type the following brew command:
$ brew install watch

watch command examples

To watch memory usage, enter:
watch free -m
To run free -m program every 5 seconds, enter:
watch -n 5 free -m
To watch disk space usage:
watch df -h
To watch the contents of a directory change, you could use
watch -d ls -l
If you are only interested in files owned by user tom, you might run:
$ watch -d 'ls -l | fgrep tom'
To watch your Linux software RAID build progress, run:
$ watch cat /proc/mdstat


  • The -d flag will highlight the differences between successive updates.
  • The -n {SECOND} flag use to specify a different interval.

To see all supported options, run:
$ man watch
$ watch --help
Sample outputs:

 watch [options] command
  -b, --beep             beep if command has a non-zero exit
  -c, --color            interpret ANSI color and style sequences
  -d, --differences[=<permanent>]
                         highlight changes between updates
  -e, --errexit          exit if command has a non-zero exit
  -g, --chgexit          exit when output from command changes
  -n, --interval <secs>  seconds to wait between updates
  -p, --precise          attempt run command in precise intervals
  -t, --no-title         turn off header
  -x, --exec             pass command to exec instead of "sh -c"
 -h, --help     display this help and exit
 -v, --version  output version information and exit
For more details see watch(1).

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 3 comments so far... add one
CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
3 comments… add one
  • Anonymous Sep 22, 2006 @ 19:48

    that doesnt work in bsd. im searching for the solution right now, just letting you know that watch in open and freebsd does something else than it does in linux

  • John Feb 27, 2007 @ 6:35

    For FreeBSD:

    cd /usr/ports/sysutils/cmdwatch && make install clean

    then substitute cmdwatch for watch as listed above.

    The other BSD’s should be very similar.
    The stock BSD watch is for snooping on other tty’s (which can be rather useful too 😀 ).

    But thx for this, it’s helpful to keep an eye on httpd errors, during web development, as well as busloads of other tasks.

  • David Feb 23, 2009 @ 16:48

    In OpenBSD it’s the gnuwatch command. It can be installed as a package or through the ports system (misc/gnuwatch).

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum