Using the watch command

Another command that is very useful for system administration is the watch command. Even better is the fact that the watch command is extremely easy to learn as what it does is simple. It repeats the command typed immediately after it every two seconds by default. For example, you can view the output of the ls command every two seconds by typing the following command:

watch ls /home/user

This is not very exciting, is it? To illustrate what ls does, open another terminal window. In that window, create a new file in your home directory. You should see the new file appear in the output of the first window. If you delete the file, you'll see the file disappear from the watch output.

Note

To break out of the watch command, press ...

Get Linux Mint Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.