Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

Linux reboot 重啟命令完整參數說明與使用指南

編輯:Linux 教學

命令用途

重新啟動計算機,需 root 權限。

語法格式

reboot [-n] [-w] [-d] [-f] [-i]

參數詳細

參數說明
-n重啟前不將記憶體緩衝數據寫回硬碟 (可能導致數據丟失)
-w僅在 /var/log/wtmp 寫入重啟記錄,不實際重啟
-d不寫入 /var/log/wtmp 記錄 (-n 隱含此意)
-f強制重啟,不調用 shutdown 流程 (緊急情況使用)
-i重啟前關閉所有網路介面

常用範例

reboot                # 標準重啟 (等同 shutdown -r now)
reboot -f             # 強制立即重啟,跳過服務關閉腳本
reboot -i             # 關閉網路後重啟 (適用網路掛載根目錄場景)
reboot -w             # 測試 wtmp 記錄寫入,不影響運行

相關命令對比

命令效果典型用途
reboot立即重啟維護窗口快速重啟
shutdown -r now標準關機流程後重啟生產環境規範重啟
shutdown -r +5 "msg"5 分鐘後重啟,廣播通知用戶計劃性維護
init 6切換至運行級別 6 (重啟)SysVinit 系統
systemctl rebootsystemd 標準重啟現代 Linux 發行版

最佳實踐

  • 生產環境優先使用 shutdown -r 或 systemctl reboot,確保服務優雅關閉
  • reboot -f 僅用於系統掛死、無法正常關機的緊急情況
  • 重啟前執行 sync 確保緩衝區落盤
Copyright © Windows教程網 All Rights Reserved