Ubuntu 休眠指令

本篇 ShengYu 要介紹在 Ubuntu 下休眠的指令,Ubuntu 裡 Systemd 工具提供了睡眠管理的高階命令,分別有 systemctl suspendsystemctl hibernatesystemctl hybrid-sleep

Suspend 掛起模式

掛起時系統的執行資料仍然儲存在記憶體,所以會以較低的功耗消耗電量。掛起模式喚醒系統恢復非常快速,
Ubuntu 桌面版的選單只有 Suspend 掛起模式,要用其他模式可以用輸入指令的方式。我的主機 suspend 後電源燈會呈現閃爍狀態。

1
systemctl suspend # 需要權限

Suspend 模式使用範例如下,

1
2
3
4
5
6
7
8
9
10
11
$ systemctl suspend
==== AUTHENTICATING FOR org.freedesktop.login1.set-wall-message ===
Authentication is required to set a wall message
Authenticating as: shengyu,,, (shengyu)
Password:
==== AUTHENTICATION COMPLETE ===
==== AUTHENTICATING FOR org.freedesktop.login1.suspend ===
Authentication is required for suspending the system.
Authenticating as: shengyu,,, (shengyu)
Password:
==== AUTHENTICATION COMPLETE ===

Hibernate 休眠模式

Hibernate 模式,字面上的意思是休眠,將記憶體內容寫入硬碟後完全關閉電源,等同 Windows 的休眠模式。完全不耗電,恢復速度比掛起慢。我的主機 hibernate 後電源燈會關閉。

1
systemctl hibernate # 需要權限

Hibernate 模式使用範例如下,

1
2
3
4
5
6
7
8
9
10
11
$ systemctl hibernate
==== AUTHENTICATING FOR org.freedesktop.login1.set-wall-message ===
Authentication is required to set a wall message
Authenticating as: shengyu,,, (shengyu)
Password:
==== AUTHENTICATION COMPLETE ===
==== AUTHENTICATING FOR org.freedesktop.login1.hibernate ===
Authentication is required for hibernating the system.
Authenticating as: shengyu,,, (shengyu)
Password:
==== AUTHENTICATION COMPLETE ===

Hybird Sleep 混合睡眠模式

Hybird Sleep 模式,混合睡眠,只供應電源給記憶體,其餘零件全部切斷電源供給,等同 Windows 的睡眠模式。

1
systemctl hybrid-sleep # 需要權限

Hybird Sleep 模式使用範例如下,我是桌機安裝 Ubuntu 桌面版,看起來應該沒有啟用 Hybird Sleep 混合睡眠模式而是會去執行 Hibernate 休眠模式。

1
2
3
4
5
6
7
8
9
10
11
$ systemctl hybrid-sleep
==== AUTHENTICATING FOR org.freedesktop.login1.set-wall-message ===
Authentication is required to set a wall message
Authenticating as: shengyu,,, (shengyu)
Password:
==== AUTHENTICATION COMPLETE ===
==== AUTHENTICATING FOR org.freedesktop.login1.hibernate ===
Authentication is required for hibernating the system.
Authenticating as: shengyu,,, (shengyu)
Password:
==== AUTHENTICATION COMPLETE ===

以上指令會需要輸入兩次密碼,覺得麻煩可以前面加 sudo,但也不會出現任何提示訊息。

其它參考
https://caloskao.org/ubuntu-hibernate-and-sleep-mode/
https://blog.csdn.net/HermitSun/article/details/113791114
https://www.gushiciku.cn/pl/gvWd/zh-tw
https://codertw.com/%E4%BC%BA%E6%9C%8D%E5%99%A8/380170/

其它相關文章推薦
Windows 10 測試搖桿的工具