init 命令詳解


把控製命令發送給 init 守護程序。

init 進程號始終為 1,發送 TERM 信號給 init 會終止所有用戶進程、守護進程、等。

init 可用於安全關閉 重啓 停止計算機,init 是所有進程的祖先,是 Linux 係統不可或缺的程序。

強製直接關閉 Linux 係統計算機電源可能導緻進程數據丟失,使係統處於不穩定狀態 (甚至損壞硬件設備)。

shutdown 命令需有 root 權限,shutdown 是把信號發送給 init 命令,要求 init 改變 runlevel,以此進行相關操作。

關機或重啓計算機實際上是 runlevel 的調整,因此,也可使用 init 命令 (需 root 權限) 直接調整 runlevel 進行相關操作。

另請參閱: halt     poweroff     reboot

基本用法     詳細用法

init 6
			

基本語法

init [OPTIONS...] {COMMAND}
			

OPTIONS 選項

參數 EN 解釋 中文翻譯 備注
--help Show this help 展示此幫助
--no-wall Don't send wall message before halt/power-off/reboot 在停止/關機/重啓之前,不發送牆消息

 

COMMAND 命令

參數 EN 解釋 中文翻譯 備注
0 Power-off the machine 關閉機器
6 Reboot the machine 重啓機器
2, 3, 4, 5 Start runlevelX.target unit 啓動 runlevelX.target 單元
1, s, S Enter rescue mode 進入救援模式
q, Q Reload init daemon configuration 重載 init 守護程序配置
u, U Reexecute init daemon 重新執行 init 守護程序

基本用法

功能 命令 文字解釋 示例 示例解釋
關閉 init 0 關閉計算機
重啓 init 6 重啓計算機
幫助 init --help 展示幫助信息

 

版權聲明: 本文為獨傢原創稿件,版權歸 樂數軟件 ,未經許可不得轉載。