首頁·終端機命令

uptime

行程與系統

用法

uptime

一行顯示機器已開機多久和平均負載;那三個數字是 1、5、15 分鐘內可執行行程的平均數,不是百分比,所以四核上 4.00 就是滿載。

常用選項

選項含義
-pPrint it as a sentence, "up 3 weeks, 2 days" (Linux).
-sPrint the moment the machine booted (Linux).
load averageRunnable processes averaged over 1, 5 and 15 minutes. Not a percentage.

範例

uptime

How long the machine has been up, who is logged in, and the load.

uptime -p

Just the readable duration (Linux).

看什麼在跑、什麼在吃機器。先弄清是什麼,再決定殺不殺。

怎麼看

  • 方括號 [ ] 表示這部分可以不寫。
  • 省略號 … 表示可以寫多個。
  • 選項區分大小寫——有些命令裡 -r 和 -R 不是一回事。

常見問題

Q. uptime 是做什麼的?

一行顯示機器已開機多久和平均負載;那三個數字是 1、5、15 分鐘內可執行行程的平均數,不是百分比,所以四核上 4.00 就是滿載。

Q. 怎麼寫?

uptime —— 方括號表示可以省略的部分。

Q. 值得記的選項有幾個?

這裡列了 3 個,完整列表在 man uptime。這條命令屬於行程與系統。

相關命令

man 手冊: man uptime