HOW TO : Run commands at regular intervals in Linux

There are several ways to run commands repetively in Linux.. (cron, while loop etc). Here is a simple trick. Say you want to check the size of a directory using “du” every 5 seconds, you can use the following command
[bash]watch -n 5 du -ch[/bash]

Check out all the options available in watch by running “man watch” :).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.