# 关闭、暂停和休眠系统 ## systemctl命令 systemd通过systemctl命令可以对系统进行关机、重启、休眠等一系列操作。当前仍兼容部分Linux常用管理命令,对应关系如[表1](#zh-cn_topic_0151920964_t3daaaba6a03b4c36be9668efcdb61f3b)。建议用户使用systemctl命令进行操作。 **表 1** 命令对应关系

Linux常用管理命令

systemctl命令

描述

halt

systemctl halt

关闭系统

poweroff

systemctl poweroff

关闭电源

reboot

systemctl reboot

重启

## 关闭系统 关闭系统并下电,在root权限下执行如下命令: ``` systemctl poweroff ``` 关闭系统但不下电机器,在root权限下执行如下命令: ``` systemctl halt ``` 执行上述命令会给当前所有的登录用户发送一条提示消息。如果不想让systemd发送该消息,您可以添加“--no-wall”参数。具体命令如下: ``` systemctl --no-wall poweroff ``` ## 重启系统 重启系统,在root权限下执行如下命令: ``` systemctl reboot ``` 执行上述命令会给当前所有的登录用户发送一条提示消息。如果不想让systemd发送该消息,您可以添加“--no-wall”参数。具体命令如下: ``` systemctl --no-wall reboot ``` ## 使系统待机 使系统待机,在root权限下执行如下命令: ``` systemctl suspend ``` ## 使系统休眠 使系统休眠,在root权限下执行如下命令: ``` systemctl hibernate ``` 使系统待机且处于休眠状态,在root权限下执行如下命令: ``` systemctl hybrid-sleep ```