Disable Sleep Mode via Command Line for Ubuntu 22
Disable
sudo systemctl mask sleep.target
sudo systemctl mask suspend.target
sudo systemctl mask hibernate.target
sudo systemctl mask hybrid-sleep.target
Confirm Status
systemctl status sleep.target
systemctl status suspend.target
systemctl status hibernate.target
systemctl status hybrid-sleep.target
Reenable
sudo systemctl unmask sleep.target
sudo systemctl unmask suspend.target
sudo systemctl unmask hibernate.target
sudo systemctl unmask hybrid-sleep.target
Confirm New Status
systemctl status sleep.target
systemctl status suspend.target
systemctl status hibernate.target
systemctl status hybrid-sleep.target