Sleep Command in Linux

sleep command
Use Sleep command in Linux

The Sleep command in Linux is used to delay the execution of a particular script. We can fix an amount of time duration to delay the execution of the code. When we wanted to delay the execution of a code. That particular code is paused for a fixed time that we assign, then the next code will be executed. We can delay the execution time in seconds, minutes, hours, and even days. The sleep command has a syntax, and in order for the sleep command to work, we have to follow the syntax.

Read==>>How to Fix Bash Command Not Found

This article about sleep command will help you learn more about sleep commands and their functioning of sleep commands. Let us get started with the syntax that we should follow.


The sleep command has syntax. And we have to follow the syntax.

$ sleep NUMBER[suffix]

The suffix is to determine whether it is seconds, minutes, hours, or days. The suffix for sleep commands are :

  1. s for SECONDS – Default.
  2. m for Minutes.
  3. h for Hours.
  4. d for days.

Change Discord Background, Add Themes, Plugins

These commands will work only on GNU – Linux.

Sleep Command in Linux

Now let’s look at some examples.

Zip Commands in Linux

To Sleep 4 seconds, We can use:

$ sleep 4

When we explicitly don’t use any suffix and write only a number, then by default it will be in seconds. Suppose if you write suffix s then, it is not going return any errors, It will work and that is the right way of writing the sleep command.

How to run Android apps on Linux 2022

To Sleep 3.5 seconds:

Yes, we can use fractions, and the sleep command supports fractions.

$ sleep 3.5

Floating points numbers are allowed. But writing commands like sleep 3m4s doesn’t work. However, we can make 3 minutes and 4-second delays. Instead of writing 3m and 4s, we can write $ sleep 184, 3 Minutes and 4 seconds is equal to 184 Seconds.

To Sleep for 5 Minutes:

$ sleep 5m

We can also use sleep 300s to achieve the same result.

To sleep 4 Hours:

$ sleep 2h

We can also use either sleep 7200s or sleep 120m to achieve the same result.

To sleep 1 day:

$ sleep 1d

Sleep Command in bash script.

Let’s see an example of using the sleep command in a bash script.


echo "Hi, I am Sleep Command"
echo "I am sleeping for ${St} seconds"
sleep ${St} //or use can use sleep 5
echo "Done" 

To run the bash script, use the command below:

$ chmod +x

$ ./

Linux Tar Commands

Output :/

Hi, I am Sleep Command
I am sleeping for 5 seconds


We have learned about the Sleep command in Linux. Sleep commands are useful when writing a large bash script with multiple commands. In such times, we might need to delay some of the codes. For completing larges tasks. All the commands mentioned in this article will work only in GNU Linux. Also, we use the –help command for more information and — version to know the version.

$ sleep --help

$ sleep --version


In conclusion, the sleep command is a useful tool for Linux users who need to pause a script or process for a specified amount of time. By using the sleep command along with a time parameter, you can pause a script or process for a specified number of seconds, minutes, or hours.

The sleep command can be useful in a variety of situations, such as when you need to pause a script to allow a process to complete, or when you want to schedule a task to run at a specific time. It’s a simple but powerful tool that can be used in combination with other commands to create more complex scripts and automation tasks.

Overall, the sleep command is an essential tool for Linux users who need to pause a script or process for a specified amount of time. Whether you are a beginner or an experienced user, the sleep command is an easy-to-use and powerful tool that can help you automate tasks and improve your workflow. So, it is an important command to know for any Linux user.

Read now: :

How to install Photoshop on Linux

How to Ping on Discord

How to install Ubuntu 20.04 LTS

How to add Kali Linux Tools on Ubuntu [Katoolin]

How to install Python 3.9 on Debian 10 to 13 [Quickly]