在 CentOS 7 中,可以通过以下几种命令方式关机:
sudo shutdown -h now
或
sudo poweroff
-h 表示 halt(停止系统),now 表示立即执行。sudo shutdown -h +5 # 5分钟后关机
+5 替换为任意分钟数(如 +10 表示 10 分钟后关机)。sudo shutdown -h 23:30 # 当天23:30关机
如果已设置定时关机但需要取消:
sudo shutdown -c
halt 命令(立即停止系统):
bash
sudo haltinit 命令(切换到运行级别 0):
bash
sudo init 0sudo 或以 root 身份执行。shutdown -h now,因为它会友好地通知所有登录用户并有序终止进程。