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 Add a Line into Crontab from Command Line

The easy method: newline=@reboot /usr/bin/numlockx(crontab -l && echo "$newLine") | crontab - Alternative (longer version)…

Run Memory Tester On Ubuntu 20.04

GNU Grub 2.04 does have memtest86+ that could be used to perform RAM load tests.…

Uhhuh. NMI received for unknown reason 3d on CPU 4

Problem: Message from syslogd@linux03 at Aug 31 04:28:21 ... kernel:[273033.123489] Uhhuh. NMI received for unknown…