Separate two observations
This provides a convenient pause between manual measurements. Scheduling may resume the process later than requested: this command is not a precision measuring instrument.
Pauses execution for a specified duration; does not test whether another program is ready.
sleep 1
pause for one second
sleep 0.5
fractional seconds in GNU sleep
sleep 2s
explicit time unit
sleep 1m
one minute
sleep --help
installed version help
sleep introduces a delay: the shell's next sequential step starts after it
finishes. While waiting, the process normally sleeps and uses very little CPU.
That makes it useful for practising process observation.
Waiting for time and waiting for a result solve different problems. Five
seconds after starting a web server do not prove that it accepts requests.
Readiness requires checking the service itself; completion of a child task
calls for wait.
The duration is an operand, not an option. GNU sleep accepts the suffixes s,
m, h, and d; an unsuffixed number means seconds. Multiple intervals are
added together. For a portable script, use one non-negative integer number of
seconds.
Help and version options describe the program rather than start a timer. Check
the available interface with sleep --help; do not assume that other
implementations provide every GNU extension.
| Option | What it does | Example |
|---|---|---|
--help |
Show help for the installed version. | sleep --help |
--version |
Show the coreutils version. | sleep --version |
Nothing found. Try a shorter query.
This provides a convenient pause between manual measurements. Scheduling may resume the process later than requested: this command is not a precision measuring instrument.
Run the entire example in the same shell:
$! saves the PID of the latest background launch. Here, wait connects
continuation to the completion of a specific task instead of another guessed
delay.
Start sleep 30 in the foreground and press Ctrl+C. In an ordinary terminal
this interrupts the delay. You do not need to repeat the example with a long
interval to verify it.
The foreground command is still running. Wait for it or interrupt it; silence during a delay is normal. It does not by itself mean that the shell is stuck.
Check the operand: a time suffix belongs next to its number. Start with sleep
1, then compare the failing form with the installed program's help.
A delay does not limit how long a neighbouring command can run and does not replace its timeout. In an endless loop it reduces repetition frequency but provides no exit condition.
Do not terminate every process named sleep to clean up an example: somebody else's delay may belong to a working script. Use the saved PID and verify that it still identifies the intended instance.
Found an inaccuracy? Report an error in the article