Is there a way to inhibit suspend/hibernate from the command line. I want to ssh into my home computer and not have it suspend while I'm working on it.

  • Which version of Ubuntu is the remote machine running? – Ciaran Liedeman Oct 25 '11 at 17:01
  • The remote machine is running Gnome on Ubuntu 11.10. – user1477 Oct 25 '11 at 17:37
  • Is it an Ubuntu Server or desktop install? Are you sure the ssh connection is not just dying? Trying enabling keepalive and see if that makes a difference – Ciaran Liedeman Oct 26 '11 at 10:34

You also might want to try this script 1, it inhibits to suspend/turn off your machine, I use it when watching movies.


1 http://linuxtidbits.wordpress.com/2009/09/08/movietime-stop-powersaving-to-watch-a-movie/


Use xdotool instead:

sudo apt-get install xdotool

Then, in a bash loop like this

while true ; do
    DISPLAY=:0.0 xdotool key Shift_L   # send a "harmless" keypress to Xorg
    sleep 5                            # wait a little bit and do it again

You might want to disable power management in gnome-control-center.

  • Normally, I want my computer to suspend. It's a laptop and all. But when I ssh into it, I'd like suspend to be temporarily inhibited. – user1477 Oct 25 '11 at 17:38
  • 3
    Hm, perhaps find out which gconf (or dconf, in this brave new 11.10 world) keys enable/disable suspend, then write a couple of shell scripts to change them to enable/disable suspend from the command line. – Marius Gedminas Oct 25 '11 at 19:30

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.