Use the sleep command.

Example:

sleep .5 # Waits 0.5 second.
sleep 5  # Waits 5 seconds.
sleep 5s # Waits 5 seconds.
sleep 5m # Waits 5 minutes.
sleep 5h # Waits 5 hours.
sleep 5d # Waits 5 days.

One can also employ decimals when specifying a time unit; e.g. sleep 1.5s

Answer from RydallCooper on Stack Overflow
🌐
freeCodeCamp
freecodecamp.org › news › bash-sleep-how-to-make-a-shell-script-wait-n-seconds-example-command
Bash Sleep – How to Make a Shell Script Wait N Seconds (Example Command)
September 13, 2021 - The sleep command is a useful way to add pauses in your Bash script. Used in conjunction with other commands, sleep can help you create a timed alarm, run operations in the correct order, space out attempts to connect to a website, and more.
People also ask

Does `sleep` use CPU while waiting?
No. The `sleep` command suspends the process and does not consume CPU cycles during the wait period.
🌐
linuxize.com
linuxize.com › home › linux commands › linux sleep command (pause a bash script)
Linux Sleep Command (Pause a Bash Script) | Linuxize
How do I cancel a `sleep` in a script?
Press `Ctrl+C` to send `SIGINT` to the foreground process. For background sleep processes, use `kill PID` where PID is the process ID returned by `$!`.
🌐
linuxize.com
linuxize.com › home › linux commands › linux sleep command (pause a bash script)
Linux Sleep Command (Pause a Bash Script) | Linuxize
Can `sleep` accept decimal values?
Yes. The GNU version of `sleep` (used on Linux) supports floating-point numbers. For example, `sleep 0.5` pauses for half a second. The POSIX specification only requires integer support.
🌐
linuxize.com
linuxize.com › home › linux commands › linux sleep command (pause a bash script)
Linux Sleep Command (Pause a Bash Script) | Linuxize
🌐
Linuxize
linuxize.com › home › linux commands › linux sleep command (pause a bash script)
Linux Sleep Command (Pause a Bash Script) | Linuxize
January 31, 2026 - Then the sleep command pauses the script for 5 seconds. Once the specified time period elapses, the last line prints the current time. ... The following script checks whether a host is online every 5 seconds and notifies you when it becomes reachable: ... #!/bin/bash while : do if ping -c 1 192.168.1.10 &> /dev/null then echo "Host is online" break fi sleep 5 done
Top answer
1 of 8
87

Bash has a "loadable" sleep which supports fractional seconds, and eliminates overheads of an external command:

$ cd bash-3.2.48/examples/loadables
$ make sleep && mv sleep sleep.so
$ enable -f sleep.so sleep

Then:

$ which sleep
/usr/bin/sleep
$ builtin sleep
sleep: usage: sleep seconds[.fraction]
$ time (for f in `seq 1 10`; do builtin sleep 0.1; done)
real    0m1.000s
user    0m0.004s
sys     0m0.004s

The downside is that the loadables may not be provided with your bash binary, so you would need to compile them yourself as shown (though on Solaris it would not necessarily be as simple as above).

As of bash-4.4 (September 2016) all the loadables are now built and installed by default on platforms that support it, though they are built as separate shared-object files, and without a .so suffix. Unless your distro/OS has done something creative (sadly RHEL/CentOS 8 build bash-4.4 with loadable extensions deliberately removed), you should be able to do instead:

[ -z "$BASH_LOADABLES_PATH" ] &&
  BASH_LOADABLES_PATH=$(pkg-config bash --variable=loadablesdir 2>/dev/null)  
enable -f sleep sleep

(The man page implies BASH_LOADABLES_PATH is set automatically, I find this is not the case in the official distribution as of 4.4.12. If and when it is set correctly you need only enable -f filename commandname as required.)

If that's not suitable, the next easiest thing to do is build or obtain sleep from GNU coreutils, this supports the required feature. The POSIX sleep command is minimal, older Solaris versions implemented only that. Solaris 11 sleep does support fractional seconds.

As a last resort you could use perl (or any other scripting that you have to hand) with the caveat that initialising the interpreter may be comparable to the intended sleep time:

$ perl -e "select(undef,undef,undef,0.1);"
$ echo "after 100" | tclsh
2 of 8
183

The documentation for the sleep command from coreutils says:

Historical implementations of sleep have required that number be an integer, and only accepted a single argument without a suffix. However, GNU sleep accepts arbitrary floating point numbers. See Floating point.

Hence you can use sleep 0.1, sleep 1.0e-1 and similar arguments.

🌐
InterServer
interserver.net › home › linux and commands › how to use the sleep command in bash
How to Use the sleep Command in Bash - Interserver Tips
August 4, 2025 - The sleep command in Bash is used to delay the execution of a script or a command for a given period. This duration can be specified in seconds (default), minutes, hours, or days, making it versatile for different timing needs.
🌐
Namehero
namehero.com › blog › how-to-use-bash-sleep-and-why
How to Use Bash Sleep and Why
November 6, 2024 - Here's what the "sleep" command does in the bash environment, and how to use it to delay execution or implement code to retry scripts.
🌐
nixCraft
cyberciti.biz › nixcraft › howto › bash shell › linux / unix bash script sleep or delay a specified amount of time
Linux / UNIX Bash Script Sleep or Delay a Specified Amount of Time - nixCraft
May 26, 2023 - ## run commmand1, sleep for 1 minute and finally run command2 ## command1 && sleep 1m && command2 ## sleep in bash for loop ## for i in {1..10} do do_something_here sleep 5s done ## run while loop to display date and hostname on screen ## while [ : ] do clear tput cup 5 5 date tput cup 6 5 echo "Hostname : $(hostname)" sleep 1 done
Find elsewhere
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to use the linux sleep command with examples
Linux Sleep Command with Examples {Terminal and Bash}
January 27, 2025 - It is possible to assign a variable to specify the sleep command duration. To do that, create an example shell script. Take the following steps: 1. Use a text editor like Vim to create a new script file. For example, type the following command: ... #!/bin/bash SLEEP_INTERVAL="30" CURRENT_TIME=$(date +"%T") echo "Time before sleep: ${CURRENT_TIME}" echo "Sleeping for ${SLEEP_INTERVAL} seconds" sleep ${SLEEP_INTERVAL} CURRENT_TIME=$(date +"%T") echo "Time after sleep: ${CURRENT_TIME}"
🌐
AlexHost
alexhost.com › home › faq › using the sleep command in bash scripts on linux
Using the Sleep Command in Bash Scripts on Linux
June 19, 2025 - The sleep command is commonly used in scripts where you need to introduce a delay between two commands. Here are a few use cases: Pausing between Commands: Suppose you want to create a script that displays a message, waits for a few seconds, and then displays another message. Here’s how you can do it: #!/bin/bash echo "Starting process..." sleep 5 echo "Process resumed after 5 seconds." echo "Performing further operations..." echo "Process completed."
🌐
Hostinger
hostinger.com › home › tutorials › linux sleep command: syntax, options, and examples
How to use the Linux sleep command
December 22, 2025 - The Linux sleep command pauses script or command executions for a specific time. It is helpful to prevent your system from running a process too soon or too frequently while still keeping it automated.
🌐
nixCraft
cyberciti.biz › nixcraft › howto › bash shell › what does the sleep command do in linux?
What does the sleep command do in Linux? - nixCraft
December 13, 2022 - Try: $ sleep 2m Halt or sleep for 2 hours, use: $ sleep 2h First sleep for 8 hours and after that play music file named wake-up.mp3 $ sleep 8h && mplayer wake-up.mp3 · Let us see a simple example that pause script for 10 seconds. #!/bin/bash # Name: sleep-demo.sh # Purpose: bash script examples that demos sleep command # Author: Vivek Gite {https://www.cyberciti.biz} # ----------------------------------------------------------- SLEEP_TIME="10" echo "Current time: $(date +%T)" echo "Hi, I'm sleeping for ${SLEEP_TIME} seconds ..." sleep ${SLEEP_TIME} echo "All done and current time: $(date +%T)"
🌐
Linux Digest
linuxdigest.com › home › bash scripting › make bash sleep for less than a second
Make bash sleep for less than a second - Linux Digest
December 13, 2020 - Unbelievably, sleep also accepts scientific e notation. This could be useful if you need to pass very small values. In the example, here below, we tell sleep to pause for 0.001 seconds (millisecond). ... If you want you can always have bash calculate the value for you as well.
🌐
Linux Handbook
linuxhandbook.com › bash-sleep
Using Linux Sleep Command in Bash Scripts
July 1, 2021 - Though you can use it in a shell directly, the sleep command is commonly used to introduce a delay in the execution of a bash script.
🌐
SS64
ss64.com › bash › sleep.html
sleep Man Page - Linux - SS64.com
nice - Change job scheduling priority. at(1) - Equivalent Windows commands: SLEEP - Wait for x seconds.
🌐
GeeksforGeeks
geeksforgeeks.org › linux-unix › sleep-command-in-linux-with-examples
sleep Command in Linux with Examples - GeeksforGeeks
July 19, 2024 - This article covered basic usage ... The Bash `Sleep` Command serves as a pause button, enabling computers to wait for a specified duration before proceeding to the next task in a script....
🌐
Joshuarosato
joshuarosato.com › posts › bash-sleep-command
Mastering the Bash Sleep Command: A Complete Guide with Examples | Joshua Rosato
December 9, 2025 - The sleep command in Bash is a simple but powerful utility that allows you to pause script execution for a specified amount of time.
🌐
Baeldung
baeldung.com › home › processes › infinite sleep for infinite blocking in bash
Infinite Sleep for Infinite Blocking in Bash | Baeldung on Linux
May 16, 2024 - This command traps the signals TERM and INT and then executes the sleep infinity command in the background, preventing it from being interrupted. Further, the wait command ensures that the shell doesn’t exit until the background process completes. This way, we configured an infinite wait loop that ignores interrupt attempts via the TERM and INT signals, which is useful when we want a Bash script to continue to be blocked despite interrupt attempts.
🌐
GitHub
gist.github.com › fazlearefin › b8060b333cce9df3f2074434d3308857
Bash | Sleep random seconds · GitHub
Bash | Sleep random seconds. GitHub Gist: instantly share code, notes, and snippets.