Linux hibernation, suspend (standby), shutdown and other commands of the difference and how to achieve; How to enable sleep mode for Ubuntu

Source: Internet
Author: User

Here are some of the Linux commands to organize, there are: Sleep, suspend, standby, shutdown and other commands of the difference and how to achieve.

hibernation is a more power-saving mode that saves in-memory data to the hard disk and all devices stop working. When you need to press the ON/off button again, the machine will revert to the state you were doing when you were performing hibernation without having to perform the complex process of starting the operating system again.

standby (hang) is the current running data in memory , the machine only supplies memory, and the hard disk, screen and CPU and other components will stop power. Because the data is stored in fast memory, it is faster to enter the wait state and wake up. However, this data is stored in memory and can cause data loss if power is lost.

Turn off the machine immediately:

 
1 2 3 4 sudo haltsudo init 0sudo shutdown -h now shutdown -h 0

Timed/delayed Shutdown:

 
1 2 sudo shutdown -h 19:30sudo shutdown -h +30   ##单位为分钟

Restart:

 
1 2 3 sudo rebootsudo init 6sudo shutdown -r now

Dormancy:

 
1 2 3 4 5 sudo pm-hibernate echo “disk” > /sys/power/state sudo hibernate-disk

Standby (hang):

 
2 " Span style= "FONT-SIZE:18PX;" >3 5 6 sudo pm-suspend sudo pm-suspend-hybrid   echo "Mem" > /sys/power/state   sudo hibernate- ram
Ah, time.    How to enable sleep mode for Ubuntu

We all know that Windows has a sleep mode, in fact, Ubuntu also has. Hibernation is a very useful feature, but unfortunately the default is removed by Ubuntu, but we can easily enable Ubuntu sleep mode by using the method described in this article. we all know that Windows has a sleep mode, in fact, Ubuntu also has. The sleep mode simply means that everything in memory can be written to the hard disk when the user is temporarily away, and when the user turns on the next time, it can boot directly to the last saved state.

For example, you are using LibreOffice to process a document, while opening a lot of reference pages and other files, when the time comes, you are afraid to come back the next day to find those reference pages and files, etc. will affect your writing ideas, now you can leave Ubuntu hibernation. After hibernation, Ubuntu will write all the unfinished processing tasks to the hard disk and then shut down, the next time the boot will automatically call the last state from the hard disk.

Check if Ubuntu hibernation mode is normal

Now we're going to check to see if the current Ubuntu allows sleep mode, to allow hibernation we'd better assign the current system a SWAP partition of the same size as the memory (most of the users will be assigned when the system is installed). Use the Ctrl + Alt + T shortcut to open a terminal and execute the following command:

    1. sudo pm-hibernate

After the command is executed, Ubuntu will automatically shut down and power down. Once again, if everything is OK, we will be able to restore directly to the last shutdown state, which indicates that the current Ubuntu system sleep mode is working properly.

Note: If the status and session are not restored or other errors are encountered before the shutdown, it may be caused by a number of reasons, and you will need to go through the error before proceeding to the next step.

re-enable hibernation

If you have confirmed that Ubuntu hibernation mode works on your system through the above steps, we can add the "Hibernate" button back to our menu.

Execute the following command to create a com.ubuntu.enable-hibernate.pkla file in the /etc/polkit-1/localauthority/50-local.d/ directory:

    1. sudo vi /etc/polkit-1/localauthority/-local. d/com. Ubuntu. Enable-hibernate. Pkla

Write the following in the above file:

    1. [enable hibernate in Logind
    2. identity=unix-user: *
    3. action =org.. Login1. Hibernate
    4. resultactive=yes

Ubuntu has been fully supported in low-power mode from 14.04, and the above configuration file should be able to call completion. But if you're using an earlier version of Ubuntu you can try the following:

    1. [enable hibernate in Upower
    2. identity= unix-user:*
    3. action=< Span class= "PLN" >org.. Upower. Hibernate
    4. resultactive=yes

Note: The above wording does not apply to Ubuntu 13.10

If you are not entirely sure or for the sake of insurance, you can also write both of them into the com.ubuntu.enable-hibernate.pkla configuration file.

  1. [Enable Hibernate in upower]
  2. Identity=Unix-user:*
  3. Action=org. FreeDesktop. Upower. Hibernate
  4. Resultactive=Yes
  5. [Enable Hibernate in logind]
  6. Identity=Unix-user:*
  7. Action=org. FreeDesktop. Login1. Hibernate
  8. Resultactive=Yes

After the configuration file has been modified, we need to restart the system or restart the indicator session:

    1. Killall indicator-session-service

The "Hibernate" option will appear when the reboot is good.

Hibernation is a very useful feature, unfortunately the default is removed by Ubuntu, but we can easily use the method described in this article to enable Ubuntu sleep mode, interested friends quickly try it!

Linux hibernation, suspend (standby), shutdown and other commands of the difference and how to achieve; How to enable sleep mode for Ubuntu

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.