htop
行程與系統
用法
htop帶顏色和滑鼠支援的 top 重寫版,F9 就能直接發訊號,但系統預設不帶,得先 `apt install htop` 或 `brew install htop`。
常用選項
| 選項 | 含義 |
|---|---|
| -u <user> | Start filtered to one user's processes. |
| -p <pid>[,<pid>] | Show only these PIDs. |
| -t | Start in tree view, children under their parent. |
| -d 10 | Refresh delay in tenths of a second, so 10 means one second. |
| F4 / F5 / F6 / F9 | Keys inside htop: filter, tree, sort column, send a signal. |
範例
htop -u www-dataWatch only the web server processes.
htop -tOpen in tree view to see which process spawned which.
看什麼在跑、什麼在吃機器。先弄清是什麼,再決定殺不殺。
怎麼看
- 方括號 [ ] 表示這部分可以不寫。
- 省略號 … 表示可以寫多個。
- 選項區分大小寫——有些命令裡 -r 和 -R 不是一回事。
常見問題
Q. htop 是做什麼的?
帶顏色和滑鼠支援的 top 重寫版,F9 就能直接發訊號,但系統預設不帶,得先 `apt install htop` 或 `brew install htop`。
Q. 怎麼寫?
htop —— 方括號表示可以省略的部分。
Q. 值得記的選項有幾個?
這裡列了 5 個,完整列表在 man htop。這條命令屬於行程與系統。
相關命令
man 手冊: man htop