sleep

sleep does nothing for a given length of time, then exits.

sleep number[suffix]...
$ sleep 5          # pause for five seconds
$ sleep 1.5h       # pause for an hour and a half

It is used to space things out — a pause between the steps of a script, a delay before a retry.

Specifying the duration #

number may be a whole number or a fraction. A suffix gives the unit:

SuffixUnit
sSeconds. This is the default if no suffix is given.
mMinutes.
hHours.
dDays.

Given more than one argument, sleep waits for the sum of them — sleep 1m 30s pauses for ninety seconds.

Exit status #

CodeMeaning
0The full time elapsed.
1A bad argument, or sleep was interrupted before the time was up.

Edit this page