-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux sleep Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to sleep on Linux, covering Arch Linux, CachyOS, and other distributions including delays, script pauses, and timing operations.
Basic usage:
# Sleep for seconds
sleep 5
# Waits 5 secondsScript delay:
#!/bin/bash
echo "Starting..."
sleep 3
echo "Done!"Basic delay:
# Sleep 5 seconds
sleep 5
# Waits 5 secondsLonger delay:
# Sleep 2 minutes
sleep 2m
# m = minutesDelay in loop:
#!/bin/bash
for i in {1..5}; do
echo "Iteration $i"
sleep 1
doneWait for condition:
#!/bin/bash
while ! ping -c 1 server; do
echo "Waiting for server..."
sleep 5
doneAdd delays:
# Sleep 1 minute 30 seconds
sleep 1m 30s
# Sums delays: 90 seconds totalMixed units:
# Sleep 1 hour 30 minutes 15 seconds
sleep 1h 30m 15s
# All units supportedCheck installation:
# sleep is part of coreutils
# Usually pre-installed
# Check sleep
which sleepThis guide covered sleep usage, delays, and script timing for Arch Linux, CachyOS, and other distributions.
- Bash Scripting Guide - Scripting basics
- time Guide - Command timing
- watch Guide - Periodic execution
-
sleep Documentation:
man sleep
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.