How to Keep Linux Awake and Prevent Screen Sleep

How to Keep a Linux Computer and Display Awake

by Heinz Tschabitscher | Apr 26, 2026 | Useful Tech

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.

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:

  1. 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.

  2. Click the Gnome quick settings menu to the status bar’s right.

    Gnome keyboard shortcut: Press Super S to open the menu.

  3. 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.
    Setting a timer for keeping Gnome Linux awake using Caffeine

Got yourself a gnome on espresso?

Buy La De Du a tea

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:

  1. 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.
  2. Enable Disable Automatic Suspending.
    Optional: Also Disable Screen Blanking and Locking to keep the screen from turning off.
    Keeping Linxu from sleeping or turning off the screen with Stimulator

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:

  1. Install wakepy.
    Prerequisite: Wakepy is a Python script, so Python3 needs to be installed on the machine.
    Here’s how: Typically, pip install wakepy will install wakepy most conveniently, but other methods are possible as well.
  2. Run wakepy -p on a command line to keep both computer and display awake.
    Display snooze: Alternatively, run wakepy -r to 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:

  1. Open Caffeine settings.
    Here’s how: You can access settings from Extensions or Extension Manager, for example.
  2. Go to the Apps tab.
  3. Click + Add.
  4. Highlight the desired application.
  5. Click Select.
  6. Choose in what state the applications will engage Caffeine under Apps trigger Caffeine mode.
    Set up Caffeine to always keep a Linux computer awake when a particular application is running

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)

Home » Useful Tech » How to Keep Linux Awake and Prevent Screen Sleep