Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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.



share|improve this answer

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
share|improve this answer

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

share|improve this answer
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
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 posting your answer, you agree to the privacy policy and terms of service.

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