sleep
is a command-line utility that allows you to suspends the calling process for a specified time. In other words, the sleep
command pauses the execution of the next command for a given number of seconds.
The sleep
command is useful when used within a bash shell script, for example, when retrying a failed operation or inside a loop.
In this tutorial, we will show you how to use the Linux sleep
command.
sleep
CommandThe syntax for the sleep
command is as follows:
sleep NUMBER[SUFFIX]...
Copy
The NUMBER
may be a positive integer or a floating-point number.
The SUFFIX
may be one of the following:
s
- seconds (default)m
- minutesh
- hoursd
- daysWhen no suffix is specified, it defaults to seconds.
When two or more arguments are given, the total amount of time is equivalent to the sum of their values.
#sleep #linux sleep #bash script #bash