在Linux中,有多種方法可以關機或重啟計算機
使用shutdown
命令:
關機命令:
sudo shutdown -h now
重啟命令:
sudo shutdown -r now
其中,-h
表示關機,-r
表示重啟,now
表示立即執行。
使用poweroff
命令:
關機命令:
sudo poweroff
重啟命令:
sudo poweroff -r
使用init
命令:
關機命令:
sudo init 0
重啟命令:
sudo init 6
其中,0
表示關機,6
表示重啟。
使用systemctl
命令(適用于使用systemd的系統):
關機命令:
sudo systemctl poweroff
重啟命令:
sudo systemctl reboot
請注意,執行這些命令通常需要管理員權限,因此在命令前加上sudo
。