shutdown 命令詳解


shutdown 可用於安全關閉 重啓 停止計算機。 此時會被凍結 login 指令,新用戶不能再登錄。

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

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

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

另請參閱: halt     poweroff     reboot

基本語法     基本用法


shutdown [OPTIONS...] [TIME] [WALL...]
			

OPTIONS 選項

參數 EN 解釋 中文翻譯 備注
--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 等效於 --poweroff,由 --halt 覆蓋 殺死應用進程,執行 sync 係統調用文件係統寫操作後停止內核
-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 --help 展示幫助信息
關機 shutdown -P time 倒數計時關閉計算機電源 shutdown -P +1 倒數 1 分鍾關閉計算機電源
重啓 shutdown -r minute 計時重啓計算機 shutdown -r +1 倒數 1 分鍾重啓計算機
shutdown -r time 定時重啓計算機 shutdown -r 20:35 20:35 時重啓計算機
shutdown -r now 立即重啓計算機
取消 shutdown -c 取消所有相關操作

 

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