Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go

Sleep Modes

20190511 Closing the lid of a laptop, for example, causes the operating system to request the hardware to proceed into some kind of sleep mode. Generally it is a mode known as S3 (suspend to RAM or S2RAM or STR). In this mode most of the hardware consuming power in the computer is turned off or into a state of reduced power consumption. The RAM (the computer's main memory) retains power so as to retain a copy of the current CPU state. When the computer is awoken, as when the laptop lid is opened, the CPU state is restored from RAM and hence can quickly continue whatever it was previously doing.

Suspend from the command line using pm-suspend as root:

$ sudo pm-suspend

Another mode is hibernation which is also known as suspend to disk or STD. Essentially all power is turned off after saving a copy of the CPU state to the disk (hard disk or solid state disk). Again, on resumption the CPU state is restored to the CPU though this may take a little more time than when restoring from RAM.

From the command line the computer can be put into hibernation using pm-hibernate as root, although not all platforms support hibernation:

$ sudo pm-hibernate

In newer Linux systems the systemd daemon is the first process that starts after a system boots and the last when a system shuts down. It can be used to manage sleep too.

$ systemctl suspend -i     # Similar to pm-suspend with -i as more forceful.

Some other interesting commands include:

$ cat /sys/power/state     # Available sleep states
freeze mem disk
$ cat /sys/power/mem_sleep # 
$ cat /sys/power/disk      # 
[platform] shutdown reboot suspend test_resume
$ sudo sh -c 'echo "disk" > /sys/power/state' # Suspend to disk?

For reference:

Copyright © 1995-2019 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware and the author of open source software including Rattle and wajig.
Also the author of Data Mining with Rattle and Essentials of Data Science.