Posted On October 9, 2021

Disable and Enable Sleep Mode on a Linux Workstation

kimconnect 0 comments
blog.KimConnect.com >> Linux >> Disable and Enable Sleep Mode on a Linux Workstation

The following commands would work on any Linux machine with SystemD (Ubuntu, Linux Mint, Redhat, Fedora, etc.)

# Disable Sleep
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

# Output sample:
kim@kim-linux:~$ sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
[sudo] password for kim:
Created symlink /etc/systemd/system/sleep.target → /dev/null.
Created symlink /etc/systemd/system/suspend.target → /dev/null.
Created symlink /etc/systemd/system/hibernate.target → /dev/null.
Created symlink /etc/systemd/system/hybrid-sleep.target → /dev/null

# Enable Sleep
sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target

# Output Sample:
kim@kim-linux:~$ sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target
Removed /etc/systemd/system/sleep.target.
Removed /etc/systemd/system/suspend.target.
Removed /etc/systemd/system/hibernate.target.
Removed /etc/systemd/system/hybrid-sleep.target.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Linux: How to Set Startup Script

In previous Linux versions, startup scripts can simply be enabled by linking a script into…

Linux: Disks & Memory Management

Step 1: Discovery of Disks on a System # Using List hardware to gather general…

Error: Kernel panic – not syncing : VFS: Unable to mount root fs on unknown-block(0,0)

If this has been caused by an interrupted system update: - Boot the system via…