What is the command for sleep/hibernate? [duplicate]
Solution 1:
All of the following commands require root permissions. The most common way to do this is prefix the command with sudo
.
The command for Suspend (Sleep) is pm-suspend
(sudo pm-suspend
etc.)
The command for Hibernate is pm-hibernate
(Note that Hibernation mode is not compatible with all hardware, please test this before using it.)
The command for the hibrid of them both is pm-suspend-hybrid
The hybrid command saves the session to the Hard Disk (safer storage place), but the system will stay running, allowing for faster resume. This does not mean you can turn off your computer and have your session saved. You will need to use the regular hibernate command for that.
These commands are provided by the package pm-utils, installed by default in Ubuntu 12.04LTS
Source: http://manpages.ubuntu.com/manpages/precise/man8/pm-action.8.html
If you have problems with those commands, please see the source. It states that
On some hardware putting the video card in the suspend state and recovering from it needs some special quirk handling. With the --quirk-* options of the pm-suspend and pm-suspend-hybrid commands you can select which quirks should be used.
A list of these quirks, and what they mean can be found here
Solution 2:
As an FYI, you can get the hibernation option back in the system menu by making the following changes (you should test the hibernate function from a terminal before doing this to ensure that it works properly):
gksu gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
The previous command will open a new text file. Copy and paste the following into this new file:
[Enable Hibernate]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
Save and close the file.
Log out and log back in, and Hibernate should appear as an option in the system menu.