systemd-inhibit: a built-in Linux alternative to macOS's "caffeinate" command

by
, posted

In short: try systemd-inhibit if you’re looking for an alternative to macOS’s caffeinate.

macOS’s caffeinate command prevents your computer from going to sleep, which can be useful. It’s been ported to Linux…but if you’re like me, you don’t like installing unnecessary software.

Good news: there’s a similar command already installed if you’re on a system that uses systemd: systemd-inhibit.

This command is roughly equivalent to caffeinate make:

systemd-inhibit make

This will prevent your system from sleeping, shutting down, or idling while make runs.

The two commands are slightly different, of course. For example, I don’t think there’s an equivalent to caffeinate -d in systemd-inhibit. But if this command works for you, give it a try instead of installing something new.