0

In this tip, we will see how to execute a command via the Terminal after a specific period of time. You can delay a command in seconds, minutes or hours.

Delay A Command In Seconds

To execute a command after 10 seconds, for example, then use this command:

sleep 10 ; sudo command

Replace "command" with the command you want to execute. Here is an example:

sleep 10 ; dir

To execute a command as root, then use this command:

sleep 10 ; sudo command

Here is an example:

sleep 10 ; sudo apt-get update



Delay A Command In Minutes

Via the terminal run this command:

sleep 10m ; command

To execute a command as root, issue this command:

sleep 10m ; sudo command



Delay A Command In Hours

Use simply this command:

sleep 2h ; command

To run a command as root, use this command:

sleep 2h ; sudo command

If you have more commands used to delay the execution of commands, then mention them below.

Post a Comment

 
Top