關機cmd

在 Ubuntu 中,你可以透過終端機 (Terminal) 使用以下指令來關機:

常用指令

  • 立即關機
    sudo shutdown -h now
    
    -h 表示 halt (停止),now 表示立刻執行。
  • 定時關機 (例如 10 分鐘後)
    sudo shutdown -h +10
    
    這會在 10 分鐘後自動關機。
  • 指定時間關機 (例如晚上 23:00)
    sudo shutdown -h 23:00
    
  • 另一種快速關機方式
    sudo poweroff
    
    sudo halt
    
  • 重新啟動
    sudo reboot
    

小提醒

  • 需要 sudo 權限才能執行這些指令。
  • 如果你在遠端 (例如 SSH) 使用這些指令,系統會直接斷線。

Ubuntu 常用電源管理指令速查表

功能類別 指令 說明
🔌 關機 sudo shutdown -h now 立即關機
sudo shutdown -h +10 10 分鐘後關機
sudo shutdown -h 23:00 指定時間 (23:00) 關機
sudo poweroff 快速關機
sudo halt 停止系統 (halt)
🔄 重啟 sudo reboot 立即重啟
sudo shutdown -r +5 5 分鐘後重啟
sudo shutdown -r 07:30 指定時間 (07:30) 重啟
🖥️ 其他 sudo shutdown -c 取消已排程的關機/重啟
systemctl list-jobs 查看目前排程
systemctl poweroff 使用 systemctl 關機
systemctl reboot 使用 systemctl 重啟

這樣的表格可以直接當作你的 命令行小抄,快速查找需要的電源管理指令。