Skip to content

Sleeping and waiting on Linux

The Linux sleep and wait commands allow you to run commands at a chosen pace or capture and display the exit status of a task after waiting for it to finish. Sleep simply inserts a timed pause between commands. Wait, on the other hand, waits until a process completes before notifying you that it has finished.


The sleep command pauses for a specified time. It’s generally used in a script, but works on the command line as well. In the example below, sleep pauses a minute between the two date commands.

$ date; sleep 60; date
Wed Sep 8 12:10:40 PM EDT 2021
Wed Sep 8 12:11:40 PM EDT 2021
Summarizing your command-line usage on Linux

The sleep command takes the numeric argument as the number of seconds. You can, however, ask it to sleep for various amounts of time by adding another character to the argument:
1m = 1 minute
2h = 2 hours
3d = 3 days
$ date; sleep 1m; date
Wed Sep 8 12:16:38 PM EDT 2021
Wed Sep 8 12:17:38 PM EDT 2021

In fact, you can sleep for less than a second if you need.

To read this article in full, please click here

Source:: Network World – Data Center