How to Use watch Command

If you need to execute a certain command repeatedly, you may use the watch command to do the repeating for you.

In this example, the command ps will be run every 2 seconds to monitor how fast the new processes spawn:

$ watch -n2 "ps aux|grep http"

The watch command will run ps every two seconds and it will display the output in stdout. You may increase or decrease the interval as necessary. This is useful if you want to monitor a process at certain time intervals. Personally, I use this to check for processes that spawns children way too fast.