Techie
Techie

Reputation: 45124

How to run a command at regular intervals from the terminal ( every 5 seconds )

I want to run a command at regular intervals ( every 5 seconds ) from the terminal.

./script.sh 

The above command gives me the O/P. I would like to see the real-time output of the script in my terminal.

PS: I don't want to run it as a cronjob

Upvotes: 2

Views: 1801

Answers (1)

Techie
Techie

Reputation: 45124

watch is used to run any command at regular intervals and displays the output of the command on the terminal window. It is useful when you have to execute a command repeatedly and watch the command output change over time.

watch -n INTERVAL_IN_SECONDS COMMAND

Command would be

watch -n 5 ./script.sh

Upvotes: 2

Related Questions