Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

Linux 關機與重啟:shutdown 命令常用用法整理

shutdown 是 Linux 上最安全的關機與重啟工具,它會先通知系統內已登入的用戶,再依序停止服務,避免資料損毀。

常用形式

1. 關機(關閉服務後停止系統):

shutdown -h now

2. 重啟(關閉服務後重新啟動):

shutdown -r now

3. 取消已經排定的 shutdown 作業:

shutdown -c

4. 不真的關機,只對登入用戶發出警告訊息,常用於預告維護:

shutdown -k +10 "系統將於十分鐘後維護"

5. 範例:十分鐘後關機並提示用戶:

shutdown -h 10 "I will shutdown after 10mins"

補充:若只是暫時登出,用 exit 或 logout;要立即重啟也可直接用 reboot,立即關機則是 poweroff 或 halt,但 shutdown 的通知機制對多人共用的主機更為周全。

Copyright © Linux教程網 All Rights Reserved