The version of sleep bundled in GNUcoreutils was written by Jim Meyering and Paul Eggert.[3] The command is also available in the OS-9 shell,[4] in the KolibriOS Shell,[5] and part of the FreeDOSPackage group Utilities.[6] The FreeDOS version was developed by Trane Francks and is licensed under the GPL.[7]
A sleep command is also part of ASCII's MSX-DOS2 Tools for MSX-DOS version 2.[8]
In PowerShell, sleep is a predefined command alias for the Start-Sleepcmdlet which serves the same purpose.[9]Microsoft also provides a sleep resource kit tool for Windows which can be used in batch files or the command prompt to pause the execution and wait for some time.[10] Another native version is the timeout command which is part of current versions of Windows.[11]
The command is available as a separate package for Microsoft Windows as part of the UnxUtils collection of nativeWin32ports of common GNU Unix-like utilities.[12] The sleep command has also been ported to the IBM i operating system.[13]
Usage
sleepnumber
Where number is an integer[14] number to indicate the time period in seconds. Some implementations support floating point numbers.
Options
None.
Examples
sleep30
Causes the current terminal session to wait 30 seconds.
sleep18000
Causes the current terminal session to wait 5 hours
GNU sleep
sleep3h;mplayerfoo.mp3
Wait 3 hours then play the file foo.mp3
Note that sleep 5h30m and sleep 5h 30m are illegal since sleep takes only one value and unit as argument. However, sleep 5.5h (a floating point[15]) is allowed. Consecutive executions of sleep can also be used.
sleep5h;sleep30m
Sleep 5 hours, then sleep another 30 minutes.
The GNU Project's implementation of sleep (part of coreutils) allows the user to pass an arbitrary floating point[15] or multiple arguments, therefore sleep 5h 30m (a space separating hours and minutes is needed) will work on any system which uses GNU sleep, including Linux.
Possible uses for sleep include scheduling tasks and delaying execution to allow a process to start, or waiting until a shared network connection most likely has few users to wget a large file.