該如何重新啟動?如何關機?

該如何重新啟動?如何關機?

Ubuntu 關機、重新開機指令

shutdown [參數] [Time]

shutdown 參數

  • shutdown -r 系統重新開機
  • shutdown -h 讓系統停止運作關機
  • shutdown -c 取消關機指令
  • shutdown -k 模擬關機,只會對使用者提出警告

關機並關電源

  • $shutdown –help      //可以檢視shutdown命令如何使用,當然也可以使用man shutdown命令。
  • $shutdown -h now      //立即關機
  • $shutdown -h 0      //立即關機
  • $shutdown -h +3      //3分鐘後關機
  • $shutdown -h 18:45 “Server is going down for maintenance"      //18:45關機並提醒

重新開機

  • $reboot      //立即重新開機
  • $shutdown -r 0     //立即重新開機
  • $shutdown -r now     //立即重新開機
  • $shutdown -r +3      //3分鐘後重新開機
  • $shutdown -r 20:23      //在20:23時重新開機

sync : 這個指令是將暫存區的資料寫回硬碟

所以,我們最好在關機、重新開機指令前,加上 "sync"

資料寫回硬碟,重新開機

  • $sync;sync;reboot    //資料寫回硬碟,重新開機
  • $sync;sync;init 6    //資料寫回硬碟,重新開機

資料寫回硬碟,關機

  • $sync;sync;init 0      //資料寫回硬碟,關機

關機、不關電源

  • $halt
  • $poweroff 
$halt,$poweroff 這兩個都是關機的命令,直接執行即可,但這兩個命令不會完整關閉和保存系統的服務,不建議使用。


參考資料

特色、摘要,Feature、Summary:

關鍵字、標籤,Keyword、Tag:

留言

這個網誌中的熱門文章

Ubuntu 常用指令、分類與簡介

網路設定必要參數IP、netmask(遮罩)、Gateway(閘道)、DNS

iptables的觀念與使用

了解、分析登錄檔 - log

Python 與SQLite 資料庫

Blogger文章排版範本

Pandas 模組

如何撰寫Shell Script

查詢指令或設定 -Linux 線上手冊 - man

網路相關之指令