Pause execution for a specified duration.
low risk
sleep pauses the shell for a given number of seconds (or minutes/hours with m/h suffixes on GNU sleep). Used in retry loops, rate limiting, and waiting for services to start. Often overused where proper readiness checks are better.
sleep 5Wait 5 seconds · explain & risk-check →sleep 0.5Wait 500 milliseconds (GNU sleep) · explain & risk-check →for i in {1..5}; do curl -f http://app/health && break || sleep 3; doneRetry with delay · explain & risk-check →Replace `sleep 30` in startup scripts with a readiness loop: `until curl -sf http://localhost:8080/health; do sleep 2; done` — adapts to actual readiness instead of guessing.
Reference text is hand-written and may be incomplete — check man sleep for your version. Test destructive commands on a non-production system first.