“sleep” Command Usage Examples in Linux

«
»

This tutorial explains Linux “sleep” command, options and its usage with examples.

sleep – delay for a specified amount of time.

DESCRIPTION

advertisement

`sleep’ pauses for an amount of time specified by the sum of the values of the command line arguments.

SYNOPSIS

sleep NUMBER[smhd]…

advertisement
advertisement

SUFFIX may be `s’ for seconds (the default), `m’ for minutes, `h’ for hours or `d’ for days. Unlike most implementations that require NUMBER be an integer, here NUMBER may be an arbitrary floating point number.

EXAMPLE

To incorporate pause for 5 seconds or 2 minutes in my bash shell script

advertisement

To sleep for 5 seconds, use:

sleep 5

To sleep for 2 mintus, use:

advertisement
sleep 2m

sleep Command Bash Script Example

#!/bin/bash
echo "Hi, I'm sleeping for 5 seconds..."
sleep 5
echo "I'm awake Now."

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

advertisement
If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.

Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!
advertisement
advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn | Youtube | Instagram | Facebook | Twitter