sleep Command in Linux with Examples

«
»

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

sleep – delay for a specified amount of time.

DESCRIPTION

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

SYNOPSIS

sleep NUMBER[smhd]…

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!
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

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.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). 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!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & technical discussions at Telegram SanfoundryClasses.