linux 关机方式

时间:2023-03-09 01:58:44
linux 关机方式

linux 关机命令:

1-  init 0 关机。

具体详情接受可以 init --help 查询 如下:

init [OPTIONS...] {COMMAND}

Send control commands to the init daemon.

--help Show this help
--no-wall Don't send wall message before halt/power-off/reboot

Commands:
0 Power-off the machine
6 Reboot the machine
2, 3, 4, 5 Start runlevelX.target unit
1, s, S Enter rescue mode
q, Q Reload init daemon configuration
u, U Reexecute init daemon

2-  shutdown -h now 立刻关机 shutdown 详情介绍如下:

--help Show this help
-H --halt Halt the machine
-P --poweroff Power-off the machine
-r --reboot Reboot the machine
-h Equivalent to --poweroff, overridden by --halt
-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

3- halt 命令

Halt the system.

--help Show this help
--halt Halt the machine
-p --poweroff Switch off the machine
--reboot Reboot the machine
-f --force Force immediate halt/power-off/reboot
-w --wtmp-only Don't halt/power-off/reboot, just write wtmp record
-d --no-wtmp Don't write wtmp record
--no-wall Don't send wall message before halt/power-off/reboot

4- poweroff

Power off the system.

--help Show this help
--halt Halt the machine
-p --poweroff Switch off the machine
--reboot Reboot the machine
-f --force Force immediate halt/power-off/reboot
-w --wtmp-only Don't halt/power-off/reboot, just write wtmp record
-d --no-wtmp Don't write wtmp record
--no-wall Don't send wall message before halt/power-off/reboot