关闭、暂停和休眠系统
更新时间:2026-06-04
systemctl命令
systemd通过systemctl命令可以对系统进行关机、重启、休眠等一系列操作。当前仍兼容部分Linux常用管理命令,对应关系如下表。建议用户使用systemctl命令进行操作。
命令对应关系表:
| Linux常用管理命令 | systemctl命令 | 描述 |
|---|---|---|
| halt | systemctl halt | 关闭系统 |
| poweroff | systemctl poweroff | 关闭电源 |
| reboot | systemctl reboot | 重启 |
关闭系统
- 关闭系统并下电,在root权限下执行如下命令:
Plain Text
1systemctl poweroff
- 关闭系统但不下电机器,在root权限下执行如下命令:
Plain Text
1systemctl halt
执行上述命令会给当前所有的登录用户发送一条提示消息。如果不想让systemd发送该消息,您可以添加“--no-wall”参数。具体命令如下:
Plain Text
1systemctl --no-wall poweroff
重启系统
重启系统,在root权限下执行如下命令:
Plain Text
1systemctl reboot
执行上述命令会给当前所有的登录用户发送一条提示消息。如果不想让systemd发送该消息,您可以添加“--no-wall”参数。具体命令如下:
Plain Text
1systemctl --no-wall reboot
使系统待机
使系统待机,在root权限下执行如下命令:
Plain Text
1systemctl suspend
使系统休眠
使系统休眠,在root权限下执行如下命令:
Plain Text
1systemctl hibernate
使系统待机且处于休眠状态,在root权限下执行如下命令:
Plain Text
1systemctl hybrid-sleep
评价此篇文章
