Search code examples
ubuntuterminalcommandpause

How to wait/sleep/delay in Linux terminal


This is similar to what was answered here but most of the answers were for Windows batch file. So, I decided to share for Ubuntu (20.04) Linux. Other Linux distros users are welcome to share as well.

I wanted to run a particular command multiple times from the terminal and needed it to pause for a bit before running again.


Solution

  • This is my command

    $ for i in {0..5};do echo 1; sleep 10; done

    This prints 1 6 times (counter ends in the last number in range in command line), but waits for 10 secs after each print action.

    Notice the sleep command.

    pause and timeout don't work