How do I pause for 5 seconds or 2 minutes in my bash shell script?
You need to use the sleep command to add delay for a specified amount of time. The syntax is as follows:
sleep NUMBER[SUFFIX]
Where SUFFIX may be:
- s for seconds (the default)
- m for minutes.
- h for hours.
- d for days.
To sleep for 5 seconds, use:
sleep 5
To sleep for 2 mintus, use:
sleep 2m
sleep Command Bash Script Example
#!/bin/bash echo "Hi, I'm sleeping for 5 seconds..." sleep 5 echo "all Done."
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop












{ 2 comments… read them below or add one }
with the command ‘sleep’ , for more information use the manual pages of sleep by ‘man sleep’.
sleep 5s ; echo ‘end test sleep 5sec’
sleep 1m; echo ‘end test sleep 1min’
best regards
Thanks, nice tip!