歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> [Linux]關機和重啟命令詳解

[Linux]關機和重啟命令詳解

日期:2017/3/1 13:46:45   编辑:關於Linux

Linux有如下的關機和重啟命令:shutdown, reboot, halt, poweroff,那麼它們有什麼區別呢?

shutdown - 建議使用的命令

shutdown是最常用也是最安全的關機和重啟命令,它會在關機之前調用fsck檢查磁盤,其中-h和-r是最常用的參數:
-h:停止系統服務並關機
-r: 停止系統服務後重啟
下面看幾個例子:
shutdown -h now  --立即關機
shutdown -h 10:53  --到10:53關機,如果該時間小於當前時間,則到隔天
shutdown -h +10  --10分鐘後自動關機
shutdown -r now  --立即重啟
shutdown -r +30 'The System Will Reboot in 30 Mins'   --30分鐘後重啟並並發送通知給其它在線用戶

reboot

reboot表示立即重啟,效果等同於shutdown -r now

poweroff

poweroff表示立即關機,效果等同於shutdown -h now,在多用戶模式下(Run Level 3)不建議使用。

halt

不理會目前系統狀況下,進行硬件關機,一般不建議使用
Copyright © Linux教程網 All Rights Reserved