Trying to keep your Linux laptop awake during presentations — in addition to yourself? Need to prevent a sleep or hibernation for extended periods of time, say for long downloads or remote connections? Find out here how to keep a Linux computer (and, optionally, its screen) awake ⤓ and prevent sleeping so no interruptions get in the way of your work or play.
On This Page
How to Keep Linux Awake and Prevent Screen Sleep
Gnome (Caffeine)
Time needed: 2 minutes
To keep a Linux machine running Gnome from sleeping and turning off the display:
- Install the Caffeine Gnome shell extension.
Here’s why: The extension will both offer a simple way to keep Linux from sleeping and allow you to automate the job, e.g., for certain applications.
Here’s how: You can use Extension Manager, for instance, to download and install Caffeine. - Click the Gnome quick settings menu to the status bar’s right.
Gnome keyboard shortcut: Press Super S to open the menu.
- Select Caffeine to prevent system and screen from sleeping or locking.
For a while: Click the > item to pick a timer for Caffeine to disengage automatically after a while.
Got yourself a gnome on espresso?
Tips help fuel these email and tech how-tos.
Prevent KDE Linux from Sleeping (Stimulator)
To prevent a KDE Linux desktop from sleeping, turning off the display or running a screensaver:
- Install and run Stimulator.
Here’s how: You can get Stimulator from Flathub, for example.
Not just KDE: Stimulator also works with Gnome as a (simpler) alternative to the Caffeine shell extension. - Enable Disable Automatic Suspending.
Optional: Also Disable Screen Blanking and Locking to keep the screen from turning off.
On a Mac? How to Disable Sleep on a Mac (Caffeinate -D and Pmset)
Keep Linux Awake from a Terminal (Wakepy)
To stop a Linux machine from either going to sleep or (also) from turning off the screen using a command-line utility:
- Install wakepy.
Prerequisite: Wakepy is a Python script, so Python3 needs to be installed on the machine.
Here’s how: Typically,pip install wakepywill install wakepy most conveniently, but other methods are possible as well. - Run
wakepy -pon a command line to keep both computer and display awake.
Display snooze: Alternatively, runwakepy -rto keep the computer running but allow the display to turn off.
It’s late, and the screen is still lit? How to Use Night Light for Warmer Linux Screen Colors
How to Keep a Linux Computer and Screen Awake: FAQ
Can I have an application always prevent sleep?
Yes.
Using Caffeine, for instance, you can set up applications that always engage it when running, on the active workspace or in focus. While control is not more granular than that — e.g., different actions for conditions set by app — , it is a start.
To have an application enable Caffeine automatically:
- Open Caffeine settings.
Here’s how: You can access settings from Extensions or Extension Manager, for example. - Go to the Apps tab.
- Click + Add.
- Highlight the desired application.
- Click Select.
- Choose in what state the applications will engage Caffeine under Apps trigger Caffeine mode.
Does keeping the system awake drain the battery?
Yes, naturally.
Especially high-resolution video playback — or, worse, rendering — on a brightly lit screen will consume ample amounts of power.
(Tested with Gnome 47–50; first published October 2024, last updated April 2026)