Sleep (command)

Short description: Unix command

sleep

The `sleep` command

Developer(s)| AT&T Bell Laboratories, Microsoft, Microware, Trane Francks
Initial release| November 1973; 52 years ago (1973-11)
Written in| C
Operating system| Unix, Unix-like, V, Plan 9, Inferno, OS-9, MSX-DOS, FreeDOS, Windows, KolibriOS, IBM i
Platform| Cross-platform
Type| Command
License| coreutils: GPLv3+
FreeDOS: GPLv2
Plan 9: MIT License

In computing, sleep is a command in Unix, Unix-like and other operating systems that suspends program execution for a specified time.

## Contents

* 1 Overview
* 2 Usage
* 2.1 Options
* 3 Examples
* 3.1 GNU sleep
* 4 See also
* 5 References
* 6 External links

## Overview

The sleep instruction suspends the calling process for at least the specified number of seconds (the default), minutes, hours or days.

`sleep` for Unix-like systems is part of the X/Open Portability Guide since issue 2 of 1987. It was inherited into the first version of POSIX and the Single Unix Specification.[1] It first appeared in Version 4 Unix.[2]

The version of `sleep` bundled in GNU coreutils 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 FreeDOS Package 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-Sleep` cmdlet 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 native Win32 ports of common GNU Unix-like utilities.[12] The sleep command has also been ported to the IBM i operating system.[13]

## Usage

sleep number

Where number is an integer[14] number to indicate the time period in seconds. Some implementations support floating point numbers.

### Options

None.

## Examples

sleep 30

Causes the current terminal session to wait 30 seconds.

sleep 18000

Causes the current terminal session to wait 5 hours

### GNU sleep

sleep 3h ; mplayer foo.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.

sleep 5h; sleep 30m

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.

## See also

* Sleep (system call)

## References

1. ↑ `sleep` – Commands & Utilities Reference, The Single UNIX Specification, Issue 7 from The Open Group
2. ↑ `sleep(1)` – FreeBSD General Commands Manual
3. ↑ "sleep(1): delay for specified amount of time - Linux man page". https://linux.die.net/man/1/sleep.
4. ↑ Paul S. Dayan (1992). The OS-9 Guru - 1 : The Facts. Galactic Industrial Limited. ISBN 0-9519228-0-7.
5. ↑ "Shell - KolibriOS wiki". http://wiki.kolibrios.org/wiki/Shell.
6. ↑ "ibiblio.org FreeDOS Group -- Utilities". http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/group-util.html.
7. ↑ "ibiblio.org FreeDOS Package -- sleep (Unix-like)". http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/sleep.html.
8. ↑ "MSX-DOS2 Tools User's Manual - MSX-DOS2 TOOLS ユーザーズマニュアル". April 1, 1993. https://archive.org/details/MSXDOS2TOOLS.
9. ↑ "Start-Sleep (Microsoft.PowerShell.Utility) - PowerShell". https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/start-sleep.
10. ↑ "Download Windows Server 2003 Resource Kit Tools from Official Microsoft Download Center". https://www.microsoft.com/en-us/download/details.aspx?id=17657.
11. ↑ "Timeout". https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc754891(v=ws.11).
12. ↑ "Native Win32 ports of some GNU utilities". http://unxutils.sourceforge.net/.
13. ↑ IBM. "IBM System i Version 7.2 Programming Qshell" (in en). https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzahz/rzahzpdf.pdf?view=kc.
14. ↑ "sleep(3): sleep for specified number of seconds - Linux man page". https://linux.die.net/man/3/sleep.
15. ↑ 15.0 15.1 "GNU Coreutils: sleep invocation". http://www.gnu.org/software/coreutils/sleep.

## External links

* `sleep` – Commands & Utilities Reference, The Single UNIX Specification, Issue 7 from The Open Group
* `sleep(1)` – Plan 9 Programmer's Manual, Volume 1
* `sleep(1)` – Inferno General commands Manual

* v
* t
* e

Unix command-line interface programs and shell builtins

File system|

* cat
* chmod
* chown
* chgrp
* cksum
* cmp
* cp
* dd
* du
* df
* file
* fuser
* ln
* ls
* mkdir
* mv
* pax
* pwd
* rm
* rmdir
* split
* tee
* touch
* type
* umask

Processes|

* at
* bg
* crontab
* fg
* kill
* nice
* ps
* time

User environment|

* env
* exit
* logname
* mesg
* talk
* tput
* uname
* who
* write

Text processing|

* awk
* basename
* comm
* csplit
* cut
* diff
* dirname
* ed
* ex
* fold
* head
* iconv
* join
* m4
* more
* nl
* paste
* patch
* printf
* sed
* sort
* strings
* tail
* tr
* uniq
* vi
* wc
* xargs

Shell builtins|

* alias
* cd
* echo
* test
* unset
* wait

Searching|

* find
* grep

Documentation|

* man

Software development|

* ar
* ctags
* lex
* make
* nm
* strip
* yacc

Miscellaneous|

* bc
* cal
* expr
* lp
* od
* sleep
* true and false

* Categories
* Standard Unix programs
* Unix SUS2008 utilities
* List

* v
* t
* e

Windows command-line programs and shell builtins

* COMMAND.COM
* Command Prompt
* Windows PowerShell
* Recovery Console

File system navigation|

* cd (chdir)
* dir
* popd
* pushd
* tree

File management|

* attrib
* cacls
* cipher
* compact
* copy
* del (erase)
* deltree
* expand
* icacls
* makecab
* mkdir (md)
* mklink
* move
* recover
* ren (rename)
* replace
* rmdir (rd)
* robocopy
* tar
* xcopy

Disk management|

* chkdsk
* convert
* defrag
* diskcomp
* diskcopy
* diskpart
* drvspace
* fdisk
* format
* label
* manage-bde
* subst
* scandisk
* sys
* vol
* vssadmin

Processes|

* at
* exit
* kill
* powercfg
* runas
* sc
* schtasks
* shutdown
* start
* taskkill
* tasklist

Registry|

* assoc
* ftype
* reg
* regini
* regsvr32

User environment|

* date
* mode
* path
* set
* setx
* time
* title
* ver
* whoami

File contents|

* comp
* edit
* edlin
* fc
* find
* findstr
* print
* type

Scripting|

* choice
* clip
* cscript
* doskey
* echo
* for
* forfiles
* goto
* if
* more
* pause
* prompt
* rem
* timeout

Networking|

* arp
* BITSAdmin
* cURL
* getmac
* hostname
* ipconfig
* net
* netsh
* netstat
* nslookup
* PathPing
* ping
* route
* scp
* sftp
* ssh
* ssh-add
* ssh-agent
* ssh-keygen
* ssh-keyscan
* tracert
* winrm
* winrs

Maintenance and care|

* driverquery
* eventcreate
* eventtriggers
* msiexec
* ntbackup
* sfc
* systeminfo
* w32tm
* WBAdmin
* winsat
* wmic

Boot management|

* bcdedit
* bootcfg
* fixboot
* fixmbr

Software development|

* debug
* exe2bin
* QBasic

Miscellaneous|

* cls
* dism
* dpath
* gpupdate
* help
* MSCDEX
* pentnt
* wsl

* List of DOS commands
* Environment variables

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Sleep (command). Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Software:Sleep_(command)&oldid=761909"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template