• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

watch Command Examples in Linux

by admin

If you need to keep an eye on a command whose output is changing, use the watch command. For example, to keep an eye on your load average:

$ watch 'cat /proc/loadavg'

Every two seconds, watch runs the cat command again. Use Ctrl+c to quit. To change the refresh rate to 10 seconds, type the following:

$ watch -n 10 'ls -l'

To highlight the difference between screen updates, type:

$ watch -d 'ls -l'

Type Ctrl+c to exit the watch command.

You can use the watch command to watch the size of a file. For example, to watch a large ISO file named mydownload.iso as it downloads, use the following command:

$ watch 'ls -l mydownload.iso'

watch Command Examples

1. Repeatedly run a command and show the result:

# watch command

2. Re-run a command every 60 seconds:

# watch -n 60 command

3. Monitor the contents of a directory, highlighting differences as they appear:

# watch -d ls -l

4. Repeatedly run a pipeline and show the result:

# watch 'command_1 | command_2 | command_3'

Filed Under: Linux

Some more articles you might also be interested in …

  1. boltctl Command Examples in Linux
  2. nmcli connection Command Examples in Linux
  3. modprobe Command Examples in Linux
  4. gunicorn Command Examples
  5. “az storage account” Command Examples (Manage storage accounts in Azure)
  6. jp2a Command Examples
  7. timeshift Command Examples in Linux
  8. pwdx Command Examples in Linux
  9. dpkg: command not found
  10. pw-link Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright