系统管理类命令
halt,poweroff,reboot、shutdown, init 0
1、halt:关闭操作系统
2、poweroff:关闭操作系统并关闭电源
3、reboot:重启操作系统
halt、poweroff、reboot三个命令,命令选项一样,如下所示:
--halt |
Halt the machine 关机 |
-p --poweroff |
Switch off the machine 关机并切断电源 |
--reboo |
Reboot the machine 重启系统 |
-f --force |
Force immediate halt/power-off/reboot 强制关机、切断电源、重启 |
-w --wtmp-only |
Don't halt/power-off/reboot, just write wtmp record不实际关机、切断电源、重启,仅记录操作日志/var/log/wtmp |
-d --no-wtmp |
Don't write wtmp record 不记录日志 |
--no-wall |
Don't send wall message before halt/power-off/reboot 在执行命令之前不发送 wall 消息,意味着此刻登录到系统中的用户不会看到系统将会重启的信息。 |
4、shutdown:关机
shutdown [OPTION] ...TIME [MESSAGE]
TIME:now, +m, HH:mm
-H --halt |
Halt the machine 关机 |
-P --poweroff |
Power-off the machine 关机并切断电源 |
-r --reboot |
Reboot the machine 重启 |
-h |
Equivalent to --poweroff, overridden by --halt 等同于-P |
-k |
Don't halt/power-off/reboot, just send warnings 不实际关机、切断电源、重启,只是发送警告 |
--no-wall |
Don't send wall message before halt/power-off/reboot 关机前不发送消息 |
-c |
Cancel a pending shutdown 取消挂起的关机命令 |
举例:
命令 |
说明 |
shutdown -h 12:00 |
系统将在12时准时关机。 |
shutdown -h now |
立刻关机。 |
shutdown -r now |
立刻重启系统。 |
shutdown -h +10 |
系统将在10分钟后关机。 |
5、init 0 关机、init 6 重启