# Ubuntu – Repeat a command every x interval of time in terminal

bashcommand linemonitoringscripts

How can I repeat a command every interval of time , so that it will allow me to run commands for checking or monitoring directories ?

There is no need for a script, i need just a simple command to be executed in terminal.

You can use watch command, watch is used to run any designated command at regular intervals.

Open Terminal and type:

watch -n x <your command>


change x to be the time in seconds you want.

For more help using the watch command and its options, run man watch or visit this Link.

For example : the following will list, every 60s, on the same Terminal, the contents of the Desktop directory so that you can know if any changes took place:

watch -n 60 ls -l ~/Desktop