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.
Posted on Categories Linux

Leave a Reply

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