Linux / UNIX: Bash Script Sleep or Delay a Specified Amount of Time

by on February 9, 2011 · 4 comments· LAST UPDATED February 9, 2011


How do I pause for 5 seconds or 2 minutes in my bash shell script?

You need to use the sleep command to add delay for a specified amount of time. The syntax is as follows:


Where SUFFIX may be:

  1. s for seconds (the default)
  2. m for minutes.
  3. h for hours.
  4. d for days.

To sleep for 5 seconds, use:
sleep 5
To sleep for 2 mintus, use:
sleep 2m

sleep Command Bash Script Example

echo "Hi, I'm sleeping for 5 seconds..."
sleep 5
echo "all Done."
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 4 comments… read them below or add one }

1 droopy4u February 13, 2011 at 2:41 pm

with the command ‘sleep’ , for more information use the manual pages of sleep by ‘man sleep’.

sleep 5s ; echo ‘end test sleep 5sec’
sleep 1m; echo ‘end test sleep 1min’

best regards


2 Nicholas February 14, 2011 at 1:17 am

Thanks, nice tip!


3 Terry McCall August 20, 2013 at 5:39 pm

FYI for searchers who are OSX users:

The sleep command in OSX does NOT take any suffix arguments (m/h/d). It only takes arguments in seconds.


4 test February 21, 2014 at 10:13 am



Leave a Comment

Tagged as: , , , , , , , , ,

Previous Faq:

Next Faq: