System and processes
The sleep command
Pauses execution for a while. Very useful in scripts to wait between steps.
Syntax
sleep SEGUNDOSMost useful options
s, m, h, dSuffixes for seconds, minutes, hours and days (sleep 1m)Copy-ready examples
$ sleep 2Wait 2 seconds$ sleep 1mWait 1 minute$ sleep 3 && echo listoWait and then printYou can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- In this terminal it is instant (simulated): it is for practising the syntax, not really waiting.
- Do not confuse sleep (wait) with systemctl suspend (suspend the machine).
FAQ
Can I stop it?
With Ctrl+C, or by suspending the process with Ctrl+Z or kill -STOP.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course