Block suspend while a command runs with systemd-inhibit
Wrap any long-running command so auto-suspend and idle sleep cannot interrupt it.
01Command
$ systemd-inhibit --why='Downloading large file' --mode=block curl -LO https://example.com/big.iso02What it does
Desktops suspend after an idle timeout, which happily kills a long download, rsync or benchmark. systemd-inhibit grabs the same power-management lock that media players use, for exactly as long as the wrapped command runs, and the --why string shows up in inhibit listings. Run systemd-inhibit (no arguments) to see who currently holds sleep locks.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- systemd-inhibit(1) - Ubuntu manpageEvidence: Same synopsis; explains that --mode=block takes the lock for the duration of the wrapped command and --why= sets a human-readable reason.
- systemd-inhibit(1) — Arch Manual PagesEvidence: Documents systemd-inhibit [OPTIONS...] [COMMAND] with --what=, --who=, --why= and --mode= (block/delay) options.
Last verified: 2026-09-19 · Category: System & Settings
06Related solutions
timedatectl lists, sets, and verifies the system timezone and NTP sync status on systemd distributions.
hostnamectl sets the static, transient, and pretty hostname in one step on systemd distros, no reboot required.
systemctl list-timers shows every scheduled timer unit with its last and next run times, which many users forget replaces cron on modern distros.