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 halt sudo init 0 sudo shutdown -h now
shutdown -h 0 |
Timed/delayed Shutdown:
1 2 |
sudo shutdown -h 19:30 sudo shutdown -h +30 ##单位为分钟 |
Restart:
1 2 3 |
sudo reboot sudo init 6 sudo 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:
- 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:
- sudo vi /etc/polkit-1/localauthority/-local. d/com. Ubuntu. Enable-hibernate. Pkla
Write the following in the above file:
- [enable hibernate in Logind
- identity=unix-user: *
- action =org.. Login1. Hibernate
- 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:
- [enable hibernate in Upower
- identity= unix-user:*
- action=< Span class= "PLN" >org.. Upower. Hibernate
- 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.
- [Enable Hibernate in upower]
- Identity=Unix-user:*
- Action=org. FreeDesktop. Upower. Hibernate
- Resultactive=Yes
- [Enable Hibernate in logind]
- Identity=Unix-user:*
- Action=org. FreeDesktop. Login1. Hibernate
- Resultactive=Yes
After the configuration file has been modified, we need to restart the system or restart the indicator session:
- 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