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.
-tStart in tree view, children under their parent.
-d 10Refresh delay in tenths of a second, so 10 means one second.
F4 / F5 / F6 / F9Keys inside htop: filter, tree, sort column, send a signal.

htop -u www-data

Watch only the web server processes.

htop -t

Open 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