关闭、暂停和休眠系统

systemctl 命令

systemd 通过 systemctl 命令可以对系统进行关机、重启、休眠等一系列操作。当前仍兼容部分 Linux 常用管理命令,对应关系如表1。建议用户使用 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

results matching ""

    No results matching ""