Commandline way to put the computer into sleep mode?

smcrae's picture


I know the halt or shutdown command will allow me to turn off the computer from a bash prompt.

But how can I put the computer into sleep mode from the commandline?

The apmsleep command complains it does not have something compiled into the kernel and there is no way I want to recompile the kernel to do this. There has to be some magic bash command to let me do this. Anyone know what it is?


1's picture

As a superuser:
# suspend

et voila!

If this doesn't work, try inistaling pm-utils. Then, you can also go into hibernate mode.

Thanks! pm-suspend is just

smcrae's picture

Thanks! pm-suspend is just what I wanted.

I added a line of "smcrae ALL = NOPASSWD: /usr/sbin/pm-suspend" to /etc/sudoers and now "sudo pm-suspend" does exactly what I want.