How do I suspend over ssh?

Just type <enter>~& (that's three keystrokes: enter, squggle, ampersand) and ssh will go into the background, and eventually timeout by itself. That's good if you want to just abandon an interactive session in a case like this.

Or, alternatively, put that into a shell script on MyLocalPC and connect in a way that will background the connection:

ssh -f MyLocalPC go-to-sleep

For me the simplest is to use the at command:

echo 'pm-suspend' | sudo at now + 2 minutes

Then disconnect from SSH session.


You need to enable the X11 forwarding using ssh -Y. Alternatively, use at now + 2 minutes to run the command only once (see man at for more information).


set a cron job for 2 minutes in the future and disconnect