How to Use the Linux watch Command for Easier Output Tracking

6565

Jack Wallen introduces you to a Linux command that can automatically execute a program repeatedly, so you can easily monitor the output for troubleshooting.

The watch command comes installed, by default, on nearly all Linux distributions and is a very useful tool to have at the ready. I want to introduce you to watch, so that it can help you with your Linux admin tasks.

What watch does

The watch command allows you to execute a program periodically, displaying the output of the command at specific intervals. Consider watch to be similar to that of using the tail command to view log files, only the output doesn’t come from a file, but another command. With this, you can watch the output of the command change over time. Out of the box, the program will execute every two seconds. So if you want to watch the output of the date command change every two seconds, you’d issue it like so:

watch date

The watch command would execute the date command every two seconds, displaying the output in the terminal window…

Read more at TechRepublic