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
🌐
nixCraft
cyberciti.biz › nixcraft › howto › linux › python sleep(): add delay in a seconds to suspend execution of a script
Python sleep(): Add Delay In A Seconds To Suspend Execution Of A Script - nixCraft
January 9, 2021 - Finally, add 1 second delay in a script using sleep(1) (line #15). Continue this procedure till user interrupts. The signal.signal() function allows defining custom handlers to be executed when a signal is received. #!/usr/bin/python # The following will run infinity times on screen till user hit CTRL+C # The program will sleep for 1 second before updating date and time again.
🌐
Real Python
realpython.com › python-sleep
Python sleep(): How to Add Time Delays to Your Code – Real Python
August 1, 2023 - The timeit module has several other command line options that you can check out in its documentation. Let’s create something a bit more realistic. A system administrator needs to know when one of their websites goes down. You want to be able to check the website’s status code regularly, but you can’t query the web server constantly or it will affect performance. One way to do this check is to use a Python sleep() system call:
🌐
Python Central
pythoncentral.io › pythons-time-sleep-pause-wait-sleep-stop-your-code
Python's time.sleep() - Pause, Stop, Wait or Sleep your Python Code | Python Central
December 30, 2021 - Essentially, as the name implies, it pauses your Python program. The time.sleep()command is the equivalent to the Bash shell's sleep command.
🌐
Programiz
programiz.com › python-programming › time › sleep
Python sleep() (With Examples)
import time while True: # get current local time as structured data current_time = time.localtime() # format the time in 12-hour clock with AM/PM formatted_time = time.strftime("%I:%M:%S %p", current_time) print(formatted_time) time.sleep(1)
🌐
CodeFatherTech
codefather.tech › home › blog › bash sleep command: a quick guide to use it in your scripts
Bash Sleep Command: A Quick Guide to Use It in Your Scripts
June 27, 2025 - Sleeping for 6 seconds..." sleep 6 else echo "File stage1.complete exists. Stage 1 complete, starting Stage 2..." rm stage1.complete exit fi done · In the second Bash shell script, we have an infinite loop. At every iteration of the script: Check if the file stage1.complete is present. ... If the file exists remove the stage1.complete file and stop the execution using the Bash exit command.
🌐
TecAdmin
tecadmin.net › sleep-delay-in-python
How to Use Sleep in Python Script – TecAdmin
April 26, 2025 - In Python programming function you can use sleep() function available under time module. This will sleep or delay script execution for the defined number of seconds. You can use time.sleep(seconds) as per following. The value passed to sleep() function is in second.
Find elsewhere
🌐
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
🌐
Delft Stack
delftstack.com › home › howto › linux › how to use the sleep command in bash
How to Use the sleep Command in Bash | Delft Stack
March 14, 2025 - Python ScipyPythonPython TkinterBatchPowerShellPython PandasNumpyPython FlaskDjangoMatplotlibDockerPlotlySeabornMatlabLinuxGitCCppHTMLJavaScriptjQueryPython PygameTensorFlowTypeScriptAngularReactCSSPHPJavaGoKotlinNode.jsCsharpRustRubyArduinoMySQLMongoDBPostgresSQLiteRVBAScalaRaspberry Pi ... The sleep command in Bash is a simple yet powerful tool that allows you to pause the execution of your scripts or commands for a specified period.
🌐
Python.org
discuss.python.org › python help
Sleep Comand Questin - Python Help - Discussions on Python.org
August 11, 2023 - Hello. 😀 😀 What is the limits of the sleep command? I need a 0.000666666665 delay ) but it does not seem to work. Sometimes it is perfect but most times it all over the page. It not constant.
🌐
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 ...
🌐
EDUCBA
educba.com › home › software development › software development tutorials › software development basics › bash sleep command
Bash Sleep Command | Complete Guide on Bash Sleep Command
March 29, 2023 - This is a guide to Bash Sleep Command. Here we discuss How does Sleep Command works in Bash and Options, along with codes and outputs.
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Linux Tip
linuxscrew.com › home › programming › python › python time.sleep() to pause, sleep, wait or stop a python script
Python time.sleep() to Pause, Sleep, Wait or Stop a Python Script
June 23, 2022 - To show that things were paused for the correct duration, the result of the time.ctime() method was printed before and after time.sleep() time.ctime() will return the current local time when it is run · Computers execute code very, very quickly – If you’re building interactive apps you’ll need to pause every now and then to let the user catch up! Click here for more Python stuff! SHARE: Related Articles · How to use the Bash wait Command (it's Different to sleep) Using PHP sleep() and usleep() to Pause Execution [Examples] Using the 'sleep' Function in Bash Scripts, with Examples ·
🌐
Mimo
mimo.org › glossary › python › time-sleep
Python time sleep: Pausing Code Execution in Python
A countdown timer can be implemented using time.sleep(). This might be useful in a command-line interface or any scenario where you want to display a countdown.
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-time-sleep
Python time.sleep(): How to Pause Execution in Python Scripts | DigitalOcean
January 27, 2026 - I am trying to create suspense" for i in message: print(i) time.sleep(0.3) When you run this script, each character appears on the screen after a short pause, creating a gradual output effect. This technique is sometimes used in command-line applications, demonstrations, or simple animations where controlled output timing improves readability or presentation.