topのヘルプ・マニュアル
日本語 英語
top --help
top: procps version 3.2.8
usage: top -hv | -abcHimMsS -d delay -n iterations [-u user | -U user] -p pid [,pid ...]
top: procps version 3.2.8
usage: top -hv | -abcHimMsS -d delay -n iterations [-u user | -U user] -p pid [,pid ...]
man top
TOP(1) Linux User’s Manual TOP(1)
名前
top - Linux のタスクを表示する
書式
top -hv | -bcisS -d delay -n iterations -p pid [, pid ...]
昔からのスイッチ ’-’ と空白の指定は任意である。
説明
top プログラムは稼働中のシステムの動的なリアルタイムの概要を報告する。
Linux カーネルが現在管理しているタスクの一覧だけでなく、システムの概 要
情 報も表示できる。表示されるシステムの概要情報のタイプと各タスクについ
て表示される情報のタイプ・順序・サイズは、ユーザーが全て設定可能で、 そ
の設定は次に起動したときにも保存できる。
こ のプログラムはプロセスの操作に関する限定された対話型インタフェースだ
けでなく、個人用の設定についての特に拡張されたインタフェースも提供し て
い る。 -- 操作の全ての面についての包括的なインタフェースを提供してい
る。このプログラムは、この文書を通して top という名前で呼ばれているが、
希 望 する任意の名前にすることができる。新しい名前 (エイリアスでもよい)
は、top の表示に反映され、設定ファイルを読み書きの際に使用される。
概要
ドキュメント
これ以降の目次
1. コマンドラインオプション
2. フィールド / カラム
a. フィールドの説明
b. カラムの選択と順序指定
3. 対話的コマンド
a. グローバルなコマンド
b. サマリーエリアのコマンド
c. タスクエリアのコマンド
d. カラーマップ
4. 別形式の表示モード
a. ウィンドウの概要
b. ウィンドウのコマンド
5. ファイル
a. システム設定ファイル
b. 個人設定ファイル
6. くだらないトリックの例
a. カーネルのトリック
b. バウンドするウィンドウ
c. 大きな雛鳥のようなウィンドウ
7. バグ, 8. 以前の top の履歴, 9. 著者, 10. 関連項目
操作
top を操作するときの最も重要な 2 つのキーは、ヘルプ (’h’ または ’?’) と
終了 (’q’) キーである。終了させるときには、代わりとして、単純に昔からの
割り込みキー (’^C’) を使うこともできる。
最初に top を起動する場合、昔からの以下のスクリーンの要素が表示され る:
1) サマリーエリア; 2) メッセージ/プロンプト行 3) カラムヘッダ; 4) タス
クエリア。しかし、以前の top と比較すると、いくつかの違いがある。
ハイライト
サマリーエリア: 負荷 (load) / 稼働時間 (uptime) の値はハイライトされ
ず、その他の要素の値のみがハイライトされる。
タスクエリア: 実行中 (または実行の準備がされている) のタスクがハイラ
イトされる。これらのプロセスを強調する唯一の手段は太字で表示すること
である。
内容/ラベル
サマリーエリア: プログラム名が表示される。シンボリックリンク名または
エイリアスが表示される場合もある。 Cpu(s) 状態ラベルは他のものが表示
さ れる可能性を暗に示している。メモリ統計では小文字 ’k’ が使用される
。
カラムヘッダ: 新しいフィールドといくつかの変更されたラベルが表示され
る。 top をカスタマイズすれば新しいフィールドが更に表示される。
注意: top の表示は 512 文字に制限される。全てのフィールドを表示するため
には最低 160 文字が必要である。残りの幅は ’Command’ カラムに使用でき る
。
起動時のデフォルト値
以 下の起動時のデフォルトは、設定ファイルの使用を仮定していないので、ユ
ーザーはカスタマイズできない。しかし、アスタリスク (’*’) の付いたコマン
ドはコマンドラインで上書きできる。
全体のデフォルト
’A’ - 別形式表示 Off (全画面)
* ’d’ - 遅延時間 3.0 秒
’I’ - Irix モード On (’solaris’ smp ではない)
* ’p’ - PID の監視 Off
* ’s’ - セキュアモード Off (非セキュアモード)
’B’ - 太字表示 Off
サマリーエリアのデフォルト
’l’ - 負荷平均/稼働時間 On (プログラム名が表示される)
’t’ - タスク/Cpu 統計 On (1+1 行。’1’ を参照)
’m’ - メモリ/スワップ使用量 On (2 行を使う)
’1’ - シングル Cpu On (smp の場合 1 行になる)
タスクエリアのデフォルト
’b’ - 太字によるハイライト On (背景と前景を「反転」しない)
* ’c’ - コマンドライン Off (コマンドラインではない名前)
* ’i’ - アイドルタスク On (全てのタスクを表示する)
’R’ - 逆順ソート On (pid の降順でソートする)
* ’S’ - 累積時間 Off (死んだ子プロセスを累積しない)
’x’ - カラムのハイライト Off (フィールドをソートする)
’y’ - 行のハイライト On (実行中のタスクが表示される)
’z’ - カラー/単色 Off (カラー表示しない)
1. コマンドラインオプション
top のコマンドラインの書式は、以下のように構成される:
-hv | -bcisS -d delay -n iterations -p pid [,pid...]
一般には必須とされているスイッチ (’-’) と空白でさえ、完全にオプションで
ある。
-b : バッチモード 操作
top を「バッチモード」で起動する。 top の出力を他のプログラムや フ
ァイルに送る場合に役立つ。このモードでは、top は入力を受け付けず、
’-n’ コマンドラインオプションで設定された繰り返し回数に達するか 、
kill されるまで実行を続ける。
-c : コマンドライン/プログラム名 トグル
最後に記録された ’c’ の状態を逆にして、top を起動する。よって、top
がコマンドラインを表示していた場合は、プログラム名を表示する。プロ
グラム名を表示していた場合は、コマンドラインを表示する。より詳しい
情報は対話的コマンド ’c’ を参照すること。
-d : 遅延時間 間隔: -d ss.tt (秒.1/10秒)
スクリーンを更新する間隔を指定する。ユーザー個人の設定ファイルにあ
るこれに対応する値、または起動時のデフォルトの値を上書きする。実行
後に対話的コマンド ’d’ または ’s’ で変更できる。
小数点以下の秒も指定できるが、負数は許可されない。しかし全ての場合
に おいて、 top が「セキュアモード」で実行されているときには、この
ような変更は禁止されている。ただし root の場合 (かつコマンドライン
オ プション ’s’ が使われていない場合) は除く。「セキュアモード」に
ついてのより詳しい情報は、「5a. システム設定ファイル」の話題を参照
すること。
-h : ヘルプ
ライブラリのバージョンと使用法のプロンプトを表示して、終了する。
-i : アイドルプロセス トグル
最 後 に 記録された ’i’ の状態を逆にして、top を起動する。トグルが
Off の場合、アイドルタスクまたはゾンビタスクは表示されない。
-n : 繰り返し回数 制限: -n number
top が終了するまでの繰り返し回数またはフレームの最大数を指定する。
-u : ユーザーを指定して監視する: -u somebody
指 定された実効 UID または実効ユーザー名にマッチするプロセスのみを
監視する。
-U : ユーザーを指定して監視する: -U somebody
指定された UID またはユーザー名にマッチするプロセスのみを監視す る
。 実・実効・保存・ファイルシステム UID とマッチするものが選ばれる
。
-p : PID を指定して監視する: -pN1 -pN2 ... または -pN1, N2 [,...]
指定されたプロセス ID とマッチするプロセスのみを監視する。このオプ
ションを 20 個まで指定するか、コンマで区切った 20 個までのプロセス
ID を指定することができる。両方を混ぜて使用することもできる。
これはコマンドラインオプションでのみ指定できる。通常の操作に戻した
い 場 合は、top を終了して再起動する必要はなく -- 対話的コマンド
’=’ を実行するだけでよい。
-s : セキュアモード 操作
たとえ root であっても、強制的にセキュアモードにして top を起動 す
る。このモードはシステムの設定ファイルで制御する方が、更に良い。 (
「5. ファイル」の話題を参照すること)。
-S : 累積時間モード トグル
最後に記録された ’S’ の状態を逆にして、top を起動する。「累積モ ー
ド」が On の場合、各プロセスはそのプロセスとそのプロセスの終了した
子プロセスで使われた cpu 時間とともに表示される。このモードのよ り
詳しい情報については、対話的コマンド ’S’ を参照すること。
-v : バージョン
ライブラリのバージョンと使用法のプロンプトを表示して、終了する。
-M : メモリ単位を検出
メモリ単位(k/M/G)を検出し浮動小数点をメモリ概要に表示する。
2. フィールド / カラム
2a. フィールドの説明
top で表示可能なフィールドを以下にリストする。これらのフィールドは、対
話的コマンド ’o’ (フィールドの順序変更) で指定できる位置に関わらず、 以
下で示す文字と常に関連付けられている。
全 てのフィールドはソート対象として選択可能であり、降順でソートするか昇
順でソートするかを制御できる。ソート機能についての詳しい情報は「3c. タ
スクエリアコマンド」の話題を参照すること。
a: PID -- プロセス ID
タ スクの一意なプロセス ID。定期的に同じ番号が使われるが、0 から再ス
タートすることはない。
b: PPID -- 親プロセスのプロセス ID
タスクの親タスクのプロセス ID。
c: RUSER -- 実ユーザー名
タスクの所有者の実ユーザー名。
d: UID -- ユーザー ID
タスクの所有者の実効ユーザー ID。
e: USER -- ユーザー名
タスクの所有者の実効ユーザー名。
f: GROUP -- グループ名
タスクの所有者の実効グループ名。
g: TTY -- 制御端末
制御端末の名前。通常はプロセスが開始されたデバイス (シリアルポート、
疑 似端末 (pty) など) であり、入出力に使われる。しかしタスクは端末に
関連付ける必要はなく、その場合は ’?’ が表示される。
h: PR -- 優先度
タスクの優先度
i: NI -- nice 値
タスクの nice 値。負の nice 値は高い優先度を意味し、正の nice 値は低
い 優 先 度 を 意味する。このフィールドが 0 の場合、タスクの割り当て
(dispatchability) を決定する際に優先度を調整していないこと意味する。
j: P -- 最後に使用された CPU (SMP)
最 後 に利用されたプロセッサを表す値。カーネルはわざと weak affinity
を使っているので、本当の SMP 環境では、この値は頻繁に変わりやすく な
る 。また実行中の top の動作そのものが (cpu 時間に対する余分な要求と
なることによって) weak affinity を壊すかもしれず、プロセスの CPU 変
更がより多くなるかもしれない。
k: %CPU -- CPU 使用率
前回のスクリーン更新からの、タスクの所要 CPU 時間の占有率。総 CPU 時
間のパーセンテージで表される。本当の SMP 環境では、「Irix モード」が
Off の場合、 top は「Solaris モード」で操作し、タスクの cpu 使用率は
総 CPU 数で割り算される。 ´Irix/Solaris’ モードは対話的コマンド ’I’
でトグルできる。
l: TIME -- CPU 時間
タ スクが開始してから利用した CPU 時間の総計。「累積モード」が On の
場合、各プロセスは終了した子プロセスが使った cpu 時間とともにリス ト
さ れ る。「累積モード」はコマンドラインオプションと対話的コマンドの
’S’ でトグルできる。このモードについての更なる情報は、対話的コマンド
’S’ を参照すること。
m: TIME+ -- CPU 時間 (1/100 単位)
´TIME’ と同じであるが、精度を 1/100 秒単位まで反映させる。
n: %MEM -- メモリ使用率 (RES)
タスクが現在使用している利用可能な物理メモリの占有率。
o: VIRT -- 仮想イメージ (kb)
タスクが使用している仮想メモリの総量。コード・データ・共有ライブラリ
・スワップアウトされているページが含まれる。
VIRT = SWAP + RES.
p: SWAP -- スワップされたサイズ (kb)
タスクの総仮想メモリイメージのうちスワップアウトされた部分。
q: RES -- 常駐サイズ (kb)
タスクが使用しているスワップされていない物理メモリ。
RES = CODE + DATA.
TP 3 r: CODE -- コードサイズ (kb) 実行可能コードに割かれる物理メモ
リ の総量。「テキスト常駐サイズ (text resident set)」または TRS とも
呼ばれる。
s: DATA -- 「データ+スタック」のサイズ (kb)
実行可能コード以外に割かれる物理メモリの総量。「データ常 駐 サ イ ズ
(data resident set)」または DRS とも呼ばれる。
t: SHR -- 共有メモリサイズ (kb)
タスクが利用している共有メモリの総量。他のプロセスと共有される可能性
のあるメモリを単純に反映している。
u: nFLT -- ページフォールト回数
あるタスクに対して起こったメジャーページフォールトの回数。ページフォ
ールトは、現在、アドレス空間にない仮想ページに対してプロセスが読み書
きしようとしたときに起こる。メジャーページフォールトとは、あるページ
を利用可能にするためにディスクアクセスが起こる場合のことである。
v: nDRT -- ダーティページ数
最後に書き込まれてから変更されたページの数。ダーティページは、対応す
る物理メモリの場所が他の仮想ページで使用される前に、ディスクに書き込
まれなければならない。
w: S -- プロセス状態
タスクの状態は以下のいずれかである:
’D’ = 割り込み不可能なスリープ状態
’R’ = 実行中
’S’ = スリープ状態
’T’ = トレース中/停止された
’Z’ = ゾンビ
実行中と表示されるタスクは「実行準備済み」と考えるのがより正しいだろ
う。 -- タスクの task_struct は Linux の実行キューで表現されている
。 本当の SMP マシン以外でさえ、top の遅延間隔と nice 値に依っては、
この状態のタスクを非常に多く目にするだろう。
x: Command -- コマンドラインまたはプログラム名
タスクを開始するのに使ったコマンドライン、またはタスクに関連づけられ
たプログラムの名前を表示する。コマンドラインとプログラム名は、コマン
ドラインオプションと対話的コマンドの ’c’ でトグルできる。
コマンドラインの表示を選択した場合、 (カーネルスレッドのように) コマ
ンドラインのないプロセスは、以下の例のように、プログラム名だけが括弧
で括られて表示される。
( mdrecoveryd )
コマンドライン・プログラム名の表示が現在のフィールド幅に対して長すぎ
る場合は、切り詰められる場合がある。フィールド幅はその他に選択されて
いるフィールド・フィールドの順番・現在のスクリーン幅に依存する。
注意: ’Command’ フィールド/カラムは固定幅でないという点が特殊であ る
。 表示の際、このカラムは残りの全てのスクリーン幅 (最大 512 文字) が
割り当てられる。これは、プログラム名からコマンドラインへの切り替えで
文字数が増える場合に備えるためである。
y: WCHAN -- スリープしている関数
カーネルリンクマップ (’System.map’) が利用可能かに否かによって、タス
クが現在スリープしているカーネル関数の名前またはアドレスが表示される
。実行中のタスクでは、このカラムにダッシュ (’-’) が表示される。
注 意: こ の フィールドを表示すると、 top 自身のワーキングセットが
700Kb 増加する。このオーバーヘッドを減らす唯一の方法は、top を停止し
て再起動することである。
z: Flags -- タスクフラグ
このカラムにはタスクの現在のスケジューリングフラグが 0 を省略した 16
進数で表示される。これらのフラグは公式には に書か れ
ている。公式なものではないが、「フィールド選択」スクリーンと「フィー
ルド順序指定」スクリーンにも説明がある。
2b. カラムの選択と順序指定
対話的コマンド ’f’ (フィールド選択) または ´o’ (フィールド順序指定) を
入 力すると、現在のフィールド文字列とその説明が記述されたスクリーンが表
示される。
以下は、top の 4 つのウィンドウ・フィールドグループのうちの 1 つのサ ン
プルのフィールド文字列と、使用される代表的なフィールドの説明である。
- サンプルのフィールド文字列:
ANOPQRSTUVXbcdefgjlmyzWHIK
- 表示されるフィールドの順番は、文字列中の文字の順番に対応する。
- 文 字が大文字の場合、(スクリーン幅が許すならば) そのフィールド自身が
タスク表示の一部として表示される。これは以下の抜粋のように、先頭のア
スタリスク (’*’)でも示される:
...
* K: %CPU = CPU usage
l: TIME = CPU Time
m: TIME+ = CPU Time, hundredths
* N: %MEM = Memory usage (RES)
* O: VIRT = Virtual Image (kb)
...
フィールド選択スクリーン -- 対話的コマンド ’f’
対応する文字を入力することで表示をトグルできる。
フィールド順序指定スクリーン -- 対話的コマンド ’o’
対応する大文字を入力することでフィールドを左に移動できる。また小文字
を入力することで右に移動できる。
3. 対話的コマンド
以下に挙げたものは、コマンドをカテゴリ分けした簡単な索引である。いく つ
かのコマンドは 1 回以上書かれている -- これはコマンドの意味やスコープ
が、そのコマンドが発行された状況に依存するためである。
3a. グローバルなコマンド
?, =, A, B, d, G, h, I, k, q, r, s, W, Z
3b. サマリーエリアのコマンド
l, m, t, 1
3c. タスクエリアのコマンド
外観: b, x, y, z
内容: c, f, o, S, u
サイズ: #, i, n
ソート: <, >, F, O, R
3d. カラーマッピング
, a, B, b, H, M, q, S, T, w, z, 0 - 7
4b. ウィンドウのコマンド
-, _, =, +, A, a, G, g, w
3a. グローバルなコマンド
グローバルな対話的コマンドは常にフルスクリーンモードと別形式の表示モ ー
ド で使用可能である。しかし「セキュアモード」で動作している場合には、こ
れらの対話的コマンドのいくつかは使用できなくなる。
top がセキュアモードか否かを前もって知りたい場合は、ヘルプコマンドを 実
行し、2 行目のシステムサマリーを見るだけでよい。
または :表示の再描画
これらのコマンドは何も行わず、単に無視される。しかし、これらのコ
マンドは top を目覚めさせ、 (最後の画面更新の) 後で表示全体が 再
描画される入力が受け付けられていた場合はそれを知らせる。
遅延間隔が長いときに現在の状態を知りたい場合は、これらのキーのい
ずれかを使うこと。
´?´ または ´h´ :ヘルプ
2 つのヘルプレベルが使用可能である。 1 つ目では全ての基本的な 対
話 的コマンドのメモを表示する。 top がセキュアな場合、このスクリ
ーンは省略される。
ヘルプスクリーンで ’h’ または ’?’ を入力すると、別形式の表示モー
ドの対話的コマンドのヘルプに移動する。
´=´ :タスク制限の終了
表 示 されるタスクの制限をなくす。このコマンドは有効になっている
’i’ (アイドルタスク) コマンドと ´n’ (最大タスク数) コマンドを 無
効 に す る。このコマンドは PID を指定した監視の「終了」も行う。
PID を指定した監視についての議論は、コマンドラインオ プ シ ョ ン
’-p’ を参照すること。
別形式の表示モードで実行すると、このコマンドは少し広い意味を持つ
。
´A´ :別形式の表示モードのトグル
このコマンドはフルスクリーンモードと別形式の表示モードを切り替え
る。「カレント」ウィンドウとフィールドグループについて知るには、
4. 別形式の表示モードと対話的コマンド ’G’ の話題を参照すること。
´B´ :太字の有効/無効のトグル
このコマンドは terminfo の「太字」機能を使用するか否かに影響し、
サマリーエリアとタスクエリアの両方の「カレント」ウィンドウを変更
する。このコマンドは本来はダム端末での使用を意図したものであるが
、いつでも適用できる。
注意: このトグルが On で top がモノクロモードで動作している場 合
、表示全体が通常のテキストになる。よって、’x’ と ’y’ (またはその
一方) のトグルを使って、強調のために表示状態を逆にしない限り、こ
れらのトグルが On になっていても、表示上は確認できない。
* ´d´ または ´s´ :遅延時間間隔の変更
秒単位の遅延時間 (表示を更新する間隔) を入力するためのプロンプト
が表示される。
小数以下の秒も受け付けるが、負の数は許されない。 0 を入力する と
(ほぼ) 連続で更新され、システムと端末ドライバが top の要求に遅れ
ないようするので、不満足な表示になってしまう。システムの負荷は遅
延の値に反比例するので、気をつけて設定すること。
現在の遅延時間を知りたい場合は、好きなときに単にヘルプコマンドを
実行して、システムサマリーの 2 行目を見ればよい。
´G´ :別ウィンドウ/フィールドグループの選択
1 から 4 までの数字を入力するためのプロンプトが表示される。こ の
数 字は「カレント」ウィンドウに設定するウィンドウ/フィールドグル
ープを示す。特に別形式の表示モードを試してみると、すぐにこれらの
4 つのウィンドウの満足度が増すだろう。
´I´ :Irix/Solaris モードのトグル
「Solaris モード」(’I’ トグルの Off) で動作している場合、タスク
の cpu 使用率は CPU の個数で割り算される。このコマンドを実行する
と、このトグルの新しい状態が表示される。
´u´ :ユーザーの選択
UID またはユーザー名を入力するプロンプトが出る。選択されたユーザ
ーに属するプロセスのみが表示される。このオプションは実効 UID に
マッチする。
´U´ :ユーザーの選択
UID またはユーザー名を入力するプロンプトが出る。選択されたユーザ
ーに属するプロセスのみが表示される。このオプションは実・実効・保
存・ファイルシステム UID にマッチする。
* ´k´ :タスクの kill
最 初に PID を入力するプロンプトが出され、その後、送信するシグナ
ルを入力するプロンプトが出される。プロンプトから反映されるデフォ
ル トのシグナルは SIGTERM である。しかし、数値または名前を指定し
て任意のシグナルを送ることができる。
kill を行う手順から抜けたい場合は、どこまで進んだかによって、 以
下の何れかを行えばよい:
1) pid プロンプトでは、単に を押す。
2) シグナルプロンプトでは、0 を入力する。
´q´ :終了
* ´r´ :タスクの renice
最 初に PID を入力するプロンプトが出され、その後、そのプロセスに
設定する nice の値を入力するプロンプトが出される。正の値を入力す
ると、プロセスの優先度は低くなる。逆に負の値を入力すると、そのプ
ロセスはカーネルから現在より有利に扱われる。
´W´ :設定ファイルの書き出し
オプション・トグル・現在のディスプレイモード・遅延時間の全てを保
存 する。 top を終了する直前にこのコマンドを発行すると、全く同じ
状態で後から再起動できる。
´Z´ :カラーマッピングの変更
このキーを入力すると、「カレント」ウィンドウまたは全てのウィンド
ウの色を変更する別のスクリーンに移る。この対話的コマンドについて
の詳細は、3d. カラーマッピングの話題を参照すること。
* アスタリスク (’*’) が付いたコマンドは「セキュアモード」では使用で き
な い。また、これらのコマンドはレベル 1 のヘルプスクリーンに表示され
ない。
3b. サマリーエリアにおけるコマンド
サマリーエリアの対話的コマンドはフルスクリーンモードと別形式の表示モ ー
ド の両方において常に利用可能である。これらは表示の先頭行に影響し、メッ
セージとプロンプトの位置を決定する。
これらのコマンドは常に「カレント」ウィンドウ/フィールドグループにだけ影
響 を与える。「カレント」ウィンドウとフィールドグループについての洞察は
、 4. 別形式の表示モードと対話的コマンド ’G’ の話題を参照すること。
´l´ :負荷平均/uptime のトグル -- On/Off
フルスクリーンモードで動作している場合は、プログラム名 (エイリア
スの可能性もある) の行も含まれる。また別形式の表示モードで動作し
ている場合は、「カレント」ウィンドウ名も含まれる。
´m´ :メモリ/スワップ利用量のトグル -- On/Off
このコマンドはサマリーエリアの 2 行に影響する。
´t´ :タスク/CPU 状態のトグル -- On/Off
このコマンドは、’1’ トグルの状態と top が本当の SMP で動作してい
るか否かによって、サマリーエリアの 2 行以上に影響する。
´1´ :1 つに纏めた CPU 状態/個々の CPU 状態のトグル -- On/Off
このコマンドは ’t’ コマンドで CPU 状態の部分をどのように表示する
かに影響する。このコマンドは元々は大規模並列な SMP マシンで使 用
するためにあるが、 SMP 環境にのみ限定されるわけではない。
サ マ リーエリア で ’Cpu(s):’ と表示されている場合、’1’ トグルは
On であり、全ての cpu 情報が 1 行に集計される。そうでないの場 合
、各 cpu は ’Cpu0, Cpu1, ...’ のように分けて表示される。
注意: どのウィンドウにおいてもサマリーエリア全体のトグルが Off の場合は
、メッセージ行のみが残される。このようにして、フルスクリーンモードに お
け るプログラム名または別形式の表示モードにおける「カレント」ウィンドウ
名を (一時的に) 犠牲にして、利用可能なタスク行を最大化できる。
3c. タスクエリアにおけるコマンド
タスクエリアの対話的コマンドはフルスクリーンモードにおいて常に利用可 能
である。
タ ス ク エリアの対話的コマンドは、「カレント」ウィンドウのタスク表示が
Off になっている場合 (4. 別形式の表示モードの話題を参照すること) は、別
形式の表示モードでは全く利用できない。
タスクウィンドウの外観
以 下のコマンドもグローバルな ’B’ (太字の無効) トグルの状態に影響を受
ける。
´b´ :太字/反転のトグル
このコマンドは ’x’ と ’y’ トグルがどのように表示されるかに影響す
る。さらにこのコマンドはこれらのトグルのうち少なくとも 1 つが On
になっている時にのみ利用可能である。
´x´ :カラムのハイライトのトグル
現在のソートフィールドのハイライトを変更する。ソートフィールドを
常に視覚的に知らせる必要はたぶんない。またパスが長くなってしまう
ので、ユーザーは常に「カラムのハイライト」を Off にして実行す る
だろうと top は仮定している。
どのフィールドでソートされているかを忘れてしまった場合、このコマ
ンドはすぐに視覚的に知らせてくれる。
´y´ :行のハイライトのトグル
「実行中」のタスクのハイライトを変更する。このタスク状態について
の 更なる考察は、 2a. フィールドとプロセス状態の説明の話題を参照
すること。
この機能はシステムの健康状態をみるための重要な情報を提供する。こ
のコマンドのコストは、端末のエスケープシーケンスするだけで、わず
かなものである。
´z´ :カラー/モノクロのトグル
「カレント」ウィンドウの色を、最も最近使われたカラー形式と、白地
に黒または黒地に白という古くからの形式で切り替える。このコマンド
はサマリーエリアとタスクエリアの両方を変更するが、 ´x’, ’y’, ’b’
トグルの状態には影響しない。
タスクウィンドウの内容
´c´ :コマンドライン/プログラム名のトグル
このコマンドは「コマンド」カラムが現在表示されているか否かによら
ず、受け付けられる。後でコマンドフィールドが表示に含まれるように
なると、ユーザーが適用した変更はすぐに反映される。
´f´ と ´o´ :フィールド選択または順序指定
これらのキーを押すと、別のスクリーンが表示される。このスクリーン
では、どのフィールドを表示するかとフィールドの順序が変更できる。
こ れらの対話的コマンドについての更なる情報は、 2b. カラムの選択
と順序指定の話題を参照すること。
´S´ :累積時間モードのトグル
「累積モード」が On の場合、各プロセスはそのプロセス自身とそのプ
ロセスの死んだ子プロセスの cpu 時間とともにリストされる。
Off の場合、多くの別々のタスクにフォークするプログラムは、現れづ
らい ´init’ やシェルのようなプログラムは表示されるが、その他のコ
ン パ イラなどはたぶん表示されない。ソートフィールドが等しく ’S’
の状態が異なる 2 つのタスクウィンドウを試して、どちらの表示法 が
よいか見て欲しい。
このコマンドを発行すると、このトグルの新しい状態が表示される。「
累積モード」が有効になっているかを前もって知りたい場合は、単にヘ
ルプを実行して、ウィンドウサマリーの 2 行目を見ればよい。
´u´ :指定されたユーザーのみの表示
表示するユーザーの名前を入力するプロンプトが出される。それ以降は
、タスクウィンドウにはマッチするユーザー ID のみが表示される。タ
スクが何も表示されなくなる場合もある。
後になって全てのタスクを再び監視したくなった場合は、このコマンド
を再度発行すればよい。ただし、プロンプトに名前は入力せず、 単 に
を押す。
タスクウィンドウのサイズ
´i´ :アイドルプロセスのトグル
全てのタスクまたはアクティブなタスクのみを表示する。このトグルが
Off の場合、アイドルプロセスまたはゾンビプロセスは表示されない。
別形式の表示モードにおいて最後のタスク表示に対してこのコマンドが
適用されても、それより前の全てのタスク表示は既に表示されているの
で、ウィンドウのサイズには影響しない。
´n´ または ´#´ :最大タスク数の設定
表示するタスク数を入力するプロンプトが出される。ユーザーが指定し
た数以下で、かつ利用可能なスクリーンの行数が使用される。
別形式の表示モードにおいて使用されると、このコマンドは、最後のタ
スク表示を除き、現在表示されている各タスク表示のサイズを正確に制
御できる。それより前の全てのタスク表示は既に描画されているので、
最後のウィンドウのサイズには影響しない。
注意: 別形式の表示モードにおいて最後に表示されるタスク表示のサイ
ズを大きくしたい場合は、それより前のタスク表示のサイズを小さくす
ること。
タスクウィンドウのソート
互 換性のため、この top は以前の top で使われていた多くのソートキーを
サポートしている。元来これは以前の top のユーザーへのサービスなので、
これらのコマンドはヘルプスクリーンには現れない 。
コマンド ソートフィールド サポート
A 開始時間 (非表示) No
M %MEM Yes
N PID Yes
P %CPU Yes
T TIME+ Yes
以下のソート機能を使う前に、対話的コマンド ’x’ を使ってカラムのハイラ
イトを一時的に有効にすることを奨める。これは実際のソート環境がユー ザ
ーの意図に合っているかを確認する助けになる。
現 在のソートフィールドが表示されている場合にのみ、以下の対話的コマン
ドを受け付ける。ソートフィールドは次の理由により表示されていないか も
しれない:
1) スクリーン幅が足りない。
2) 対話的コマンド ’f’ が Off である。
´<´ :ソートフィールドを左へ移動
ソートフィールドが表示されている最初のフィールドでない限り、ソー
トカラムを左へ移動する。
´>´ :ソートフィールドを右へ移動
ソートフィールドが表示されている最後のフィールドでない限り、ソー
トカラムを右へ移動する。
現 在のソートフィールドが表示されているか否かに関わらず、以下の対話的
コマンドは常に受け付ける。
´F´ または ´O´ :ソートフィールドの選択
これらのキーは別のスクリーンを表示させる。このスクリーンでは、ど
のフィールドをソートカラムとするかを変更できる。
以前には表示されていなかったフィールドが選択された場合、そのフィ
ールドは top の表示に戻るときに強制的に On にされる。しかし、 ス
クリーン幅と選択したフィールドの順序によっては、ソートフィールド
は表示されないかもしれない。
この対話的コマンドは、カラムのハイライトをOffにして top を実行し
ているときに、現在のソートフィールドをとても簡単に確認できる便利
な方法である。
´R´ :ソートフィールドの逆順/正順のトグル
この対話的コマンドを使うと、「高い方から低い方」と「低い方から高
い方」を切り替えることができる。
注 意: フィールドのソートには、カラムに表示されている値ではなく、内部
的な値を使っている。よって、TTY と WCHAN フィールドは厳密な ASCII 照
合順序 (collating sequence) には違反するかもしれない。
3d. カラーマッピング
対話的コマンド ’Z’ を発行すると、別のスクリーンが表示される。このスクリ
ーンでは、top の表示に戻る前に、「カレント」ウィンドウのみまたは 4 つの
ウィンドウ全ての色を変更できる。
利用可能な対話的コマンド
4 つの大文字で対象を選択する。
8 つの数字で色を選択する。
通常のトグルが利用可能である
’B’ :太字の無効/有効
’b’ :実行中のタスクを「太字」/反転
’z’ :カラー/モノクロ
その他のコマンドも利用可能である
’a’/’w’ :適用し、次/前へ行く。
:適用し、終了する。
’q’ :現在の変更を破棄し、終了する。
´a’ または ’w’ を使って対象となるウィンドウを順番に選択し、そのウィンド
ウを抜けるときに表示されているカラー形式を適用できる。もちろん、任意 の
ウ ィンドウに戻って別な色を再適用したり、 ´z’ トグルで色を完全に Off に
することも簡単にできる。
カラーマッピングスクリーンは、フルスクリーンモードまたは別形式の表示 モ
ードにおける「カレント」ウィンドウ/フィールドグループを変更するのにも使
える。 ´q’ または が押されたときに対象とされていたフィールド は
、 top の表示に戻ったときにカレントフィールドにされる。
4. 別形式の表示モード
4a. ウィンドウの概要
フィールドグループ/ウィンドウ:
フルスクリーンモードでは、スクリーン全体で表される単一のウィンド
ウがある。この単一のウィンドウは、 4 つの異なるフィールドグル ー
プ (以下で繰り返し出てくる対話的コマンド ’G’ を参照すること) の
うち 1 つのフィールドグループの表示に変更することもできる。 4 つ
のフィールドグループの各々には、個別に設定可能なサマリーエリアと
フィールドグループ毎のタスクエリアがある。
別形式の表示モードでは、これら 4 つのフィールドグループは同時 に
表 示することもできるし、コマンドで個別に Off にすることもできる
。
サマリーエリアは、たとえそのメッセージ行だけであっても、常に存在
する。どの時点でも1 つのサマリーエリアだけを表示することができる
。しかし、コマンドによっては、0 から 4 個までの別々のタスク表 示
がスクリーンに表示されているかもしれない。
カレントウィンドウ:
「カレント」ウィンドウとは、サマリーエリアに関連づけられたウィン
ドウと、タスクに関連するコマンドが常に送られるウィンドウである。
別形式の表示モードでは、タスク表示 のトグルを Off できるので、い
くつかのコマンドは「カレント」ウィンドウでは制限されるかもしれな
い。
サ マリーエリアの先頭行のトグルを Off にすると、更に複雑になる。
ウィンドウ名 (’l’ でトグルされる行) がないと、どのウィンドウが「
カレント」ウィンドウなのか簡単に分からなくなる。
4b. ウィンドウにおけるコマンド
´-´ と ´_´ :ウィンドウの表示/非表示のトグル
´-’ キーは「カレント」ウィンドウのタスク表示を On または Off に
する。 On の場合、このタスクエリアは ’f’ と ’o’ コマンドで確定し
た最小限のカラムヘッダしか表示しない。またこのタスクエリアは、ユ
ーザーが 0 個以上のタスクに対して適用した他のタスクエリアのオ プ
ション/トグルも反映する。
´_’ キーは同じことを全てのタスク表示に対して行う。一方、このキー
は現在表示されているタスク表示とユーザーがトグルを Off にした タ
ス ク表示を切り替える。 4 つのタスク表示が現在全て表示されている
場合、この対話的コマンドはサマリーエリアのみを表示される要素とし
て残す。
* ´=´ と ´+´ :ウィンドウの均等化 (バランスの取り直し)
´=’ キーは「カレント」ウィンドウのタスク表示を表示させる。このキ
ーは有効になっている ’i’ (アイドルタスク) と ´n’ (最大タスク 数)
コマンドを無効にする。
´+’ キーは同じことを全てのウィンドウに対して行う。 4 つのタスク
表示は再度表示され、均等にバランスがとられる。タスク表示には、ユ
ー ザーが以前に適用したカスタマイズも保持される。ただし、´i’ (ア
イドルタスク) と ’n’ (最大タスク数) コマンドは除く。
* ´A´ :別形式の表示モードのトグル
このコマンドはフルスクリーンモードと別形式の表示モードを切り替え
る。
このコマンドを初めて発行すると、4 つのタスク表示が全て表示される
。その後、モードを切り替えると、表示対象として選んだタスク表示の
みが表示される。
* ´a´ と ´w´ :次のウィンドウを前方/後方へ進める
これらのキーは「カレント」ウィンドウを変更する。コマンドが送られ
るウィンドウを順番に変更する。これらのキーは巡回する形式で動作す
るので、どちらのキーを使っても希望する 「カレント」ウィンドウ へ
辿り着ける。
ウインドウ名が表示されている (’l’ のトグルを Off にしてい な い)
場 合に、「カレント」ウィンドウの名前が強調/色付き表示されていな
いときは、タスク表示 が Off で多くのコマンドが制限されていること
を知らせている。
* ´G´ :他のウィンドウ/フィールドグループの選択
1 から 4 まで数字を入力するプロンプトが出される。この数字は「カ
レント」ウィンドウに設定するウィンドウ/フィールドグループを表 す
。
フルスクリーンモードでは、このコマンドは「カレント」ウィンドウを
変更するのに必須である。別形式の表示モードでは、’a’ と ’w’ コ マ
ンドに比べてあまり便利ではない、単なる代替コマンドである。
´g´ :ウィンドウ/フィールドグループ名の変更
「カレント」ウィンドウに適用する新しい名前を入力するプロンプトが
出される。ウィンドウ名が表示されている (’l’ のトグルが On になっ
ている) 必要はない。
* アスタリスク (’*’)が付いた対話的コマンドは、別形式の表示モード以外で
も使われる。
´=’, ’A’, ’G’ 常に利用可能である。
´a’, ’w’ カラーマッピングのときと同じ動作をする。
5. ファイル
5a. システムの設定ファイル
このファイルが存在すると、どのバージョンの「ヘルプ」スクリーンが通常 の
ユ ーザーに表示されるかに影響を与える。より重要なのは、top の実行中に通
常のユーザーに許可されることを、このファイルで制限できることである。 通
常のユーザーは以下のコマンドを発行できる。
k タスクを kill する。
r タスクを renice する。
d または s 遅延時間/スリープの間隔を変更する。
システムの設定ファイルはtopによって作成されない。逆に、ユーザーがこのフ
ァイルを手動で作成し、/etc ディレクトリに置く。このファイル名は ’toprc’
で なければならず、先頭に ’.’ (ピリオド) が付いてはならない。このファイ
ルには 2 行だけしか書かれていてはならない。
以下に /etc/toprc の内容の例を示す:
s # 1 行目: 「セキュア」モードのスイッチ
5.0 # 2 行目: 「遅延」間隔 (秒単位)
5b. 個人の設定ファイル
このファイルは ’$HOME/.top に付けた名前’ + ’rc’ として書き出される。 対
話的コマンド ’W’ で、このファイルを作成または更新できる。
以下に一般的なレイアウトを示す:
グローバル # 1 行目: プログラム名/エイリアス、メモ
" # 2 行目: id,altscr,irixps,delay,curwin
ウィンドウ毎 # 行 a : ウィンドウ名,fieldscur
" # 行 b : winflags,sortindx,maxtasks
" # 行 c : summclr,msgsclr,headclr,taskclr
環 境変数 $HOME が存在しない場合、 top は個人の設定ファイルをカレントデ
ィレクトリに書き込もうとする。ただしカレントディレクトリの権限に従う。
6. くだらないトリックのサンプル
これらの「トリック」の多くは、ユーザーが top のスケジューリングを向上さ
せ た場合に、最もうまく動作する。ここでは top を nice 値 -10 で開始する
ため、ユーザーが権限を持っていると仮定している。
6a. カーネルのマジック
これらのくだらないトリックでは、top がフルスクリーンモードになってい る
必要がある。
-*- ユーザーインタフェース (プロンプトからヘルプまで) では、意図的に遅
延間隔が 1/10 秒までに制限されている。しかしユーザーは希望する遅延
時間を自由に設定できる。 Linux が top に対して最も良いスケジューリ
ングを行うのを見たいなら、遅延時間を 0.09 秒以下にすればよい。
この実験では、X Window System で xterm をオープンして最大化する 。
その後、以下を実行する:
. スケジューリングを向上させ、遅延時間を短くする:
nice -n -10 top -d.09
. ソートされるカラムのハイライトを Off にし、
パスの長さを最小化する。
. 行の反転によるハイライトを On にして、強調する。
. いろいろなソートカラム (TIME/MEM がうまく動作する) と
正順・逆順のソートを試し、最もアクティブなプロセスが
ビューに入るようにする。
Linux がユーザーのために常に動作し、とても忙しくしているのが分かる
だろう。しかしこれを説明できるプログラムはなかった。
-*- xterm で「黒地に白」を使い、top のタスクの色を黒に設定し、タスクの
ハイライトを反転でなく太字になっていることを確認して欲しい。そして
遅延間隔を 0.3 秒程度に設定する。
最もアクティブなプロセスがビューに入った後で、現在実行中のタスクが
ゴーストのようなイメージとして見えるだろう。
-*- 既存のリソースファイルを削除するか、新しいシンボリックリンクを作成
する。この新しいバージョンを起動し、’T’ (隠しキー 3c. タスクエリア
コ マンド、ソートの話題を参照すること) を入力し、続いて ’W’ と ’q’
を入力する。最後に、プログラムを -d0 (遅延時間 0) で再度起動する。
こ の表示は前の top より 3 倍の割合で更新され、300% スピードアップ
する。 top は TIME で上位に上がってくるので、 top が最上位に到達す
るのに投資している間は、忍耐強く待って欲しい。
6b. バウンドするウィンドウ
こ れらのくだらないトリックでは、top が別形式の表示モードになっている必
要がある。
-*- 3 個または 4 個のタスク表示で表示されているときに、最後のウィン ド
ウ以外を選択し、アイドルプロセスを Off にする。 ´i’ を適用している
かによって、いくつかのタスク表示がときどきバウンドし、アコーディオ
ン のようになる。これは top がスペースを確保するのに最善を尽くして
いるためである。
-*- 各ウィンドウのサマリー行を別々に設定する: メモリ使用量の表示なし・
状 態表示なし・何も表示しない・メッセージ行のみ。そして ’a’ または
’w’ を押し続けると、バウンドするウィンドウの別バージョン -- 跳ね
上がるウインドウが見られる。
-*- 4 つのウィンドウ全てを表示し、各ウィンドウでアイドルプロセスの表示
を Off にする。そうすると「非常にバウンドする」ゾーンに入るだろ う
。
6c. 大きな雛鳥のようなウィンドウ
このくだらないトリックでも別形式の表示モードが必要である。
-*- 4 つのウィンドウ全てを表示し、1:Def が「カレント」ウィンドウになっ
ているのを確認する。そして他の全てのタスク表示が「巣から押し出され
る」まで、ウィンドウサイズを大きくし続ける。
他 のウィンドウがすべて置き換えられたら、全ての表示/非表示ウィンド
ウをトグルする。そして以下の言葉について良く考えてみよう:
top は嘘をついているのか、ユーザーが強要した
真実を正直に言っているのか?
7. バグ
バグ報告は以下に送って欲しい:
Albert D. Cahalan,
8. 以前の top の履歴
オリジナルの top は、Branko Lankester の ps プ ロ
グラムを元にして Roger Binns が書いた。
Robert Nation はこれを proc ファイ
ルシステムに適合させた。
Helmut Geyer は設定可能フィール ド
のサポートを追加した。
その他にも多くの人々が長年に渡って貢献してきた。
9. 著者
この全く新しく拡張された top の置き換え版は
Jim / James C. Warner, によって書かれた
。
以下の方々からは、計り知れない助けをしてもらった:
Albert D. Cahalan,
Craig Small,
10. 関連項目
free(1), ps(1), uptime(1), atop(1), slabtop(1), vmstat(8), w(1).
Linux September 2002 TOP(1)
TOP(1) Linux User’s Manual TOP(1)
NAME
top - display Linux tasks
SYNOPSIS
top -hv | -abcHimMsS -d delay -n iterations -p pid [, pid ...]
The traditional switches ’-’ and whitespace are optional.
DESCRIPTION
The top program provides a dynamic real-time view of a running system.
It can display system summary information as well as a list of tasks
currently being managed by the Linux kernel. The types of system sum-
mary information shown and the types, order and size of information
displayed for tasks are all user configurable and that configuration
can be made persistent across restarts.
The program provides a limited interactive interface for process manip-
ulation as well as a much more extensive interface for personal config-
uration -- encompassing every aspect of its operation. And while top
is referred to throughout this document, you are free to name the pro-
gram anything you wish. That new name, possibly an alias, will then be
reflected on top’s display and used when reading and writing a configu-
ration file.
OVERVIEW
Documentation
The remaining Table of Contents
1. COMMAND-LINE Options
2. FIELDS / Columns
a. DESCRIPTIONS of Fields
b. SELECTING and ORDERING Columns
3. INTERACTIVE Commands
a. GLOBAL Commands
b. SUMMARY Area Commands
c. TASK Area Commands
d. COLOR Mapping
4. ALTERNATE-DISPLAY Mode
a. WINDOWS Overview
b. COMMANDS for Windows
5. FILES
a. SYSTEM Configuration File
b. PERSONAL Configuration File
6. STUPID TRICKS Sampler
a. Kernel Magic
b. Bouncing Windows
c. The Big Bird Window
7. BUGS, 8. HISTORY Former top, 9. AUTHOR, 10. SEE ALSO
Operation
When operating top, the two most important keys are help (’h’ or ’?’)
and quit (’q’) key. Alternatively, you could simply use the tradi-
tional interrupt key (’^C’) when you’re done.
When you start top for the first time, you’ll be presented with the
traditional screen elements: 1) Summary Area; 2) Message/Prompt Line;
3) Columns Header; 4) Task Area. There will, however, be some differ-
ences when compared to the former top.
Highlighting
Summary_Area: There is no highlighting for load/uptime and only val-
ues are highlighted for other elements.
Task_Area: Tasks running (or ready to run) will be highlighted, and
bold is only one way of emphasizing such processes.
Content/Labels
Summary_Area: The program name is shown, perhaps a symlink or alias.
The Cpu(s) state label hints at other possibilities. The memory
stats use a lower case ’k’.
Columns_Header: Will show a new field and some changed labels. More
new fields will be found as you customize your top.
Note: the width of top’s display will be limited to 512 positions.
Displaying all fields requires a minimum of 160 characters. The
remaining width could be used for the ’Command’ column.
Startup Defaults
The following startup defaults assume no configuration file, thus no
user customizations. Even so, items shown with an asterisk (’*’) could
be overridden through the command-line.
Global_defaults
’A’ - Alt display Off (full-screen)
* ’d’ - Delay time 3.0 seconds
’I’ - Irix mode On (no, ’solaris’ smp)
* ’p’ - PID monitoring Off
* ’s’ - Secure mode Off (unsecured)
’B’ - Bold disable Off
Summary_Area_defaults
’l’ - Load Avg/Uptime On (thus program name)
’t’ - Task/Cpu states On (1+1 lines, see ’1’)
’m’ - Mem/Swap usage On (2 lines worth)
’1’ - Single Cpu On (thus 1 line if smp)
Task_Area_defaults
’b’ - Bold hilite On (not ’reverse’)
* ’c’ - Command line Off (name, not cmdline)
* ’H’ - Threads Off (show all threads)
* ’i’ - Idle tasks On (show all tasks)
’R’ - Reverse sort On (pids high-to-low)
* ’S’ - Cumulative time Off (no, dead children)
’x’ - Column hilite Off (no, sort field)
’y’ - Row hilite On (yes, running tasks)
’z’ - color/mono Off (no, colors)
1. COMMAND-LINE Options
The command-line syntax for top consists of:
-hv | -abcHimMsS -d delay -n iterations -p pid [,pid...]
The typically mandatory switches (’-’) and even whitespace are com-
pletely optional.
-a : Sort by memory usage
This switch makes top to sort the processes by allocated memory
-b : Batch mode operation
Starts top in ’Batch mode’, which could be useful for sending out-
put from top to other programs or to a file. In this mode, top
will not accept input and runs until the iterations limit you’ve
set with the ’-n’ command-line option or until killed.
-c : Command line/Program name toggle
Starts top with the last remembered ’c’ state reversed. Thus, if
top was displaying command lines, now that field will show program
names, and visa versa. See the ’c’ interactive command for addi-
tional information.
-d : Delay time interval as: -d ss.tt (seconds.tenths)
Specifies the delay between screen updates, and overrides the cor-
responding value in one’s personal configuration file or the
startup default. Later this can be changed with the ’d’ or ’s’
interactive commands.
Fractional seconds are honored, but a negative number is not
allowed. In all cases, however, such changes are prohibited if
top is running in ’Secure mode’, except for root (unless the ’s’
command-line option was used). For additional information on
’Secure mode’ see topic 5a. SYSTEM Configuration File.
-h : Help
Show library version and the usage prompt, then quit.
-H : Threads toggle
Starts top with the last remembered ’H’ state reversed. When this
toggle is On, all individual threads will be displayed. Other-
wise, top displays a summation of all threads in a process.
-i : Idle Processes toggle
Starts top with the last remembered ’i’ state reversed. When this
toggle is Off, tasks that are idled or zombied will not be dis-
played.
-m : VIRT/USED toggle
Reports USED (sum of process rss and swap total count) instead of
VIRT
-M : Detect memory units
Show memory units (k/M/G) and display floating point values in the
memory summary.
-n : Number of iterations limit as: -n number
Specifies the maximum number of iterations, or frames, top should
produce before ending.
-p : Monitor PIDs as: -pN1 -pN2 ... or -pN1, N2 [,...]
Monitor only processes with specified process IDs. This option
can be given up to 20 times, or you can provide a comma delimited
list with up to 20 pids. Co-mingling both approaches is permit-
ted.
This is a command-line option only. And should you wish to return
to normal operation, it is not necessary to quit and and restart
top -- just issue the ’=’ interactive command.
-s : Secure mode operation
Starts top with secure mode forced, even for root. This mode is
far better controlled through the system configuration file (see
topic 5. FILES).
-S : Cumulative time mode toggle
Starts top with the last remembered ’S’ state reversed. When
’Cumulative mode’ is On, each process is listed with the cpu time
that it and its dead children have used. See the ’S’ interactive
command for additional information regarding this mode.
-u : Monitor by user as: -u somebody
Monitor only processes with an effective UID or user name matching
that given.
-U : Monitor by user as: -U somebody
Monitor only processes with a UID or user name matching that
given. This matches real, effective, saved, and filesystem UIDs.
-v : Version
Show library version and the usage prompt, then quit.
2. FIELDS / Columns
2a. DESCRIPTIONS of Fields
Listed below are top’s available fields. They are always associated
with the letter shown, regardless of the position you may have estab-
lished for them with the ’o’ (Order fields) interactive command.
Any field is selectable as the sort field, and you control whether they
are sorted high-to-low or low-to-high. For additional information on
sort provisions see topic 3c. TASK Area Commands.
a: PID -- Process Id
The task’s unique process ID, which periodically wraps, though never
restarting at zero.
b: PPID -- Parent Process Pid
The process ID of a task’s parent.
c: RUSER -- Real User Name
The real user name of the task’s owner.
d: UID -- User Id
The effective user ID of the task’s owner.
e: USER -- User Name
The effective user name of the task’s owner.
f: GROUP -- Group Name
The effective group name of the task’s owner.
g: TTY -- Controlling Tty
The name of the controlling terminal. This is usually the device
(serial port, pty, etc.) from which the process was started, and
which it uses for input or output. However, a task need not be
associated with a terminal, in which case you’ll see ’?’ displayed.
h: PR -- Priority
The priority of the task.
i: NI -- Nice value
The nice value of the task. A negative nice value means higher pri-
ority, whereas a positive nice value means lower priority. Zero in
this field simply means priority will not be adjusted in determining
a task’s dispatchability.
j: P -- Last used CPU (SMP)
A number representing the last used processor. In a true SMP envi-
ronment this will likely change frequently since the kernel inten-
tionally uses weak affinity. Also, the very act of running top may
break this weak affinity and cause more processes to change CPUs
more often (because of the extra demand for cpu time).
k: %CPU -- CPU usage
The task’s share of the elapsed CPU time since the last screen
update, expressed as a percentage of total CPU time. In a true SMP
environment, if ’Irix mode’ is Off, top will operate in ’Solaris
mode’ where a task’s cpu usage will be divided by the total number
of CPUs. You toggle ’Irix/Solaris’ modes with the ’I’ interactive
command.
l: TIME -- CPU Time
Total CPU time the task has used since it started. When ’Cumulative
mode’ is On, each process is listed with the cpu time that it and
its dead children has used. You toggle ’Cumulative mode’ with ’S’,
which is a command-line option and an interactive command. See the
’S’ interactive command for additional information regarding this
mode.
m: TIME+ -- CPU Time, hundredths
The same as ’TIME’, but reflecting more granularity through hun-
dredths of a second.
n: %MEM -- Memory usage (RES)
A task’s currently used share of available physical memory.
o: VIRT -- Virtual Image (kb)
The total amount of virtual memory used by the task. It includes
all code, data and shared libraries plus pages that have been
swapped out. (Note: you can define the STATSIZE=1 environment vari-
able and the VIRT will be calculated from the /proc/#/state VmSize
field.)
p: SWAP -- Swapped size (kb)
Per-process swap values are now taken from /proc/#/status VmSwap
field.
q: RES -- Resident size (kb)
The non-swapped physical memory a task is using.
r: CODE -- Code size (kb)
The amount of physical memory devoted to executable code, also known
as the ’text resident set’ size or TRS.
s: DATA -- Data+Stack size (kb)
The amount of physical memory devoted to other than executable code,
also known as the ’data resident set’ size or DRS.
t: SHR -- Shared Mem size (kb)
The amount of shared memory used by a task. It simply reflects mem-
ory that could be potentially shared with other processes.
u: nFLT -- Page Fault count
The number of major page faults that have occurred for a task. A
page fault occurs when a process attempts to read from or write to a
virtual page that is not currently present in its address space. A
major page fault is when disk access is involved in making that page
available.
v: nDRT -- Dirty Pages count
The number of pages that have been modified since they were last
written to disk. Dirty pages must be written to disk before the
corresponding physical memory location can be used for some other
virtual page.
w: S -- Process Status
The status of the task which can be one of:
’D’ = uninterruptible sleep
’R’ = running
’S’ = sleeping
’T’ = traced or stopped
’Z’ = zombie
Tasks shown as running should be more properly thought of as ’ready
to run’ -- their task_struct is simply represented on the Linux
run-queue. Even without a true SMP machine, you may see numerous
tasks in this state depending on top’s delay interval and nice
value.
x: Command -- Command line or Program name
Display the command line used to start a task or the name of the
associated program. You toggle between command line and name with
’c’, which is both a command-line option and an interactive command.
When you’ve chosen to display command lines, processes without a
command line (like kernel threads) will be shown with only the pro-
gram name in parentheses, as in this example:
( mdrecoveryd )
Either form of display is subject to potential truncation if it’s
too long to fit in this field’s current width. That width depends
upon other fields selected, their order and the current screen
width.
Note: The ’Command’ field/column is unique, in that it is not fixed-
width. When displayed, this column will be allocated all remaining
screen width (up to the maximum 512 characters) to provide for the
potential growth of program names into command lines.
y: WCHAN -- Sleeping in Function
Depending on the availability of the kernel link map (’System.map’),
this field will show the name or the address of the kernel function
in which the task is currently sleeping. Running tasks will display
a dash (’-’) in this column.
Note: By displaying this field, top’s own working set will be
increased by over 700Kb. Your only means of reducing that overhead
will be to stop and restart top.
z: Flags -- Task Flags
This column represents the task’s current scheduling flags which are
expressed in hexadecimal notation and with zeros suppressed. These
flags are officially documented in . Less formal
documentation can also be found on the ’Fields select’ and ’Order
fields’ screens.
2b. SELECTING and ORDERING Columns
After pressing the interactive commands ’f’ (Fields select) or ´o’
(Order fields) you will be shown a screen containing the current fields
string followed by names and descriptions for all fields.
Here is a sample fields string from one of top’s four windows/field
groups and an explanation of the conventions used:
- Sample fields string:
ANOPQRSTUVXbcdefgjlmyzWHIK
- The order of displayed fields corresponds to the order of the let-
ters in that string.
- If the letter is upper case the corresponding field itself will then
be shown as part of the task display (screen width permitting).
This will also be indicated by a leading asterisk (’*’), as in this
excerpt:
...
* K: %CPU = CPU usage
l: TIME = CPU Time
m: TIME+ = CPU Time, hundredths
* N: %MEM = Memory usage (RES)
* O: VIRT = Virtual Image (kb)
...
Fields select screen -- the ’f’ interactive command
You toggle the display of a field by simply pressing the correspond-
ing letter.
Order fields screen -- the ’o’ interactive command
You move a field to the left by pressing the corresponding upper
case letter and to the right with the lower case letter.
2c. SUMMARY Area Fields
The summary area fields describing CPU statistics are abbreviated.
They provide information about times spent in:
us = user mode
sy = system mode
ni = low priority user mode (nice)
id = idle task
wa = I/O waiting
hi = servicing IRQs
si = servicing soft IRQs
st = steal (time given to other DomU instances)
3. INTERACTIVE Commands
Listed below is a brief index of commands within categories. Some com-
mands appear more than once -- their meaning or scope may vary
depending on the context in which they are issued.
3a. GLOBAL_Commands
?, =, A, B, d, G, h, I, k, q, r, s, W, Z
3b. SUMMARY_Area_Commands
l, m, t, 1
3c. TASK_Area_Commands
Appearance: b, x, y, z
Content: c, f, H, o, S, u
Size: #, i, n
Sorting: <, >, F, O, R
3d. COLOR_Mapping
, a, B, b, H, M, q, S, T, w, z, 0 - 7
4b. COMMANDS_for_Windows
-, _, =, +, A, a, G, g, w
3a. GLOBAL Commands
The global interactive commands are always available in both
full-screen mode and alternate-display mode. However, some of these
interactive commands are not available when running in ’Secure mode’.
If you wish to know in advance whether or not your top has been
secured, simply ask for help and view the system summary on the second
line.
or :Refresh_Display
These commands do nothing, they are simply ignored. However,
they will awaken top and following receipt of any input the
entire display will be repainted.
Use either of these keys if you have a large delay interval and
wish to see current status,
´?´ or ´h´ :Help
There are two help levels available. The first will provide a
reminder of all the basic interactive commands. If top is
secured, that screen will be abbreviated.
Typing ’h’ or ’?’ on that help screen will take you to help for
those interactive commands applicable to alternate-display mode.
´=´ :Exit_Task_Limits
Removes restrictions on which tasks are shown. This command
will reverse any ’i’ (idle tasks) and ’n’ (max tasks) commands
that might be active. It also provides for an ’exit’ from PID
monitoring. See the ’-p’ command-line option for a discussion
of PID monitoring.
When operating in alternate-display mode this command has a
slightly broader meaning.
´A´ :Alternate_Display_Mode_toggle
This command will switch between full-screen mode and alter-
nate-display mode. See topic 4. ALTERNATE-DISPLAY Mode and the
’G’ interactive command for insight into ´current’ windows and
field groups.
´B´ :Bold_Disable/Enable_toggle
This command will influence use of the ’bold’ terminfo capabil-
ity and alters both the summary area and task area for the ´cur-
rent’ window. While it is intended primarily for use with dumb
terminals, it can be applied anytime.
Note: When this toggle is On and top is operating in monochrome
mode, the entire display will appear as normal text. Thus,
unless the ’x’ and/or ’y’ toggles are using reverse for empha-
sis, there will be no visual confirmation that they are even on.
* ´d´ or ´s´ :Change_Delay_Time_interval
You will be prompted to enter the delay time, in seconds,
between display updates.
Fractional seconds are honored, but a negative number is not
allowed. Entering 0 causes (nearly) continuous updates, with an
unsatisfactory display as the system and tty driver try to keep
up with top’s demands. The delay value is inversely propor-
tional to system loading, so set it with care.
If at any time you wish to know the current delay time, simply
ask for help and view the system summary on the second line.
´G´ :Choose_Another_Window/Field_Group
You will be prompted to enter a number between 1 and 4 designat-
ing the window/field group which should be made the ´current’
window. You will soon grow comfortable with these 4 windows,
especially after experimenting with alternate-display mode.
´I´ :Irix/Solaris_Mode_toggle
When operating in ’Solaris mode’ (’I’ toggled Off), a task’s cpu
usage will be divided by the total number of CPUs. After issu-
ing this command, you’ll be informed of the new state of this
toggle.
´u´ :select a user
You will be prompted for a UID or username. Only processes
belonging to the selected user will be displayed. This option
matches on the effective UID.
´U´ :select a user
You will be prompted for a UID or username. Only processes
belonging to the selected user will be displayed. This option
matches on the real, effective, saved, and filesystem UID.
* ´k´ :Kill_a_task
You will be prompted for a PID and then the signal to send. The
default signal, as reflected in the prompt, is SIGTERM. How-
ever, you can send any signal, via number or name.
If you wish to abort the kill process, do one of the following
depending on your progress:
1) at the pid prompt, just press
2) at the signal prompt, type 0
´q´ :Quit
* ´r´ :Renice_a_Task
You will be prompted for a PID and then the value to nice it to.
Entering a positive value will cause a process to lose priority.
Conversely, a negative value will cause a process to be viewed
more favorably by the kernel.
´W´ :Write_the_Configuration_File
This will save all of your options and toggles plus the current
display mode and delay time. By issuing this command just
before quitting top, you will be able restart later in exactly
that same state.
´Z´ :Change_Color_Mapping
This key will take you to a separate screen where you can change
the colors for the ´current’ window, or for all windows. For
details regarding this interactive command see topic 3d. COLOR
Mapping.
* The commands shown with an asterisk (’*’) are not available in
’Secure mode’, nor will they be shown on the level-1 help screen.
3b. SUMMARY Area Commands
The summary area interactive commands are always available in both
full-screen mode and alternate-display mode. They affect the beginning
lines of your display and will determine the position of messages and
prompts.
These commands always impact just the ´current’ window/field group.
See topic 4. ALTERNATE-DISPLAY Mode and the ’G’ interactive command for
insight into ´current’ windows and field groups.
´l´ :Toggle_Load_Average/Uptime -- On/Off
This is also the line containing the program name (possibly an
alias) when operating in full-screen mode or the ´current’ win-
dow name when operating in alternate-display mode.
´m´ :Toggle_Memory/Swap_Usage -- On/Off
This command affects two summary area lines.
´t´ :Toggle_Task/Cpu_States -- On/Off
This command affects from 2 to many summary area lines, depend-
ing on the state of the ’1’ toggle and whether or not top is
running under true SMP.
´1´ :Toggle_Single/Separate_Cpu_States -- On/Off
This command affects how the ’t’ command’s Cpu States portion is
shown. Although this toggle exists primarily to serve mas-
sively-parallel SMP machines, it is not restricted to solely SMP
environments.
When you see ’Cpu(s):’ in the summary area, the ’1’ toggle is On
and all cpu information is gathered in a single line. Other-
wise, each cpu is displayed separately as: ’Cpu0, Cpu1, ...’
Note: If the entire summary area has been toggled Off for any window,
you would be left with just the message line. In that way, you will
have maximized available task rows but (temporarily) sacrificed the
program name in full-screen mode or the ´current’ window name when in
alternate-display mode.
3c. TASK Area Commands
The task area interactive commands are always available in full-screen
mode.
The task area interactive commands are never available in alter-
nate-display mode if the ´current’ window’s task display has been tog-
gled Off (see topic 4. ALTERNATE-DISPLAY Mode).
APPEARANCE of task window
The following commands will also be influenced by the state of the
global ’B’ (bold disable) toggle.
´b´ :Bold/Reverse_toggle
This command will impact how the ’x’ and ’y’ toggles are dis-
played. Further, it will only be available when at least one of
those toggles is On.
´x´ :Column_Highlight_toggle
Changes highlighting for the current sort field. You probably
don’t need a constant visual reminder of the sort field and top
hopes that you always run with ’column highlight’ Off, due to
the cost in path-length.
If you forget which field is being sorted this command can serve
as a quick visual reminder.
´y´ :Row_Highlight_toggle
Changes highlighting for "running" tasks. For additional
insight into this task state, see topic 2a. DESCRIPTIONS of
Fields, Process Status.
Use of this provision provides important insight into your sys-
tem’s health. The only costs will be a few additional tty
escape sequences.
´z´ :Color/Monochrome_toggle
Switches the ´current’ window between your last used color
scheme and the older form of black-on-white or white-on-black.
This command will alter both the summary area and task area but
does not affect the state of the ’x’, ’y’ or ’b’ toggles.
CONTENT of task window
´c´ :Command_Line/Program_Name_toggle
This command will be honored whether or not the ’Command’ column
is currently visible. Later, should that field come into view,
the change you applied will be seen.
´f´ and ´o´ :Fields_select or Order_fields
These keys display separate screens where you can change which
fields are displayed and their order. For additional informa-
tion on these interactive commands see topic 2b. SELECTING and
ORDERING Columns.
´H´ :Threads_toggle
When this toggle is On, all individual threads will be dis-
played. Otherwise, top displays a summation of all threads in a
process.
´S´ :Cumulative_Time_Mode_toggle
When ’Cumulative mode’ is On, each process is listed with the
cpu time that it and its dead children have used.
When Off, programs that fork into many separate tasks will
appear less demanding. For programs like ’init’ or a shell this
is appropriate but for others, like compilers, perhaps not.
Experiment with two task windows sharing the same sort field but
with different ’S’ states and see which representation you pre-
fer.
After issuing this command, you’ll be informed of the new state
of this toggle. If you wish to know in advance whether or not
’Cumulative mode’ is in effect, simply ask for help and view the
window summary on the second line.
´u´ :Show_Specific_User_Only
You will be prompted to enter the name of the user to display.
Thereafter, in that task window only matching User ID’s will be
shown, or possibly no tasks will be shown.
Later, if you wish to monitor all tasks again, re-issue this
command but just press at the prompt, without providing
a name.
SIZE of task window
´i´ :Idle_Processes_toggle
Displays all tasks or just active tasks. When this toggle is
Off, idled or zombied processes will not be displayed.
If this command is applied to the last task display when in
alternate-display mode, then it will not affect the window’s
size, as all prior task displays will have already been painted.
´n´ or ´#´ :Set_Maximum_Tasks
You will be prompted to enter the number of tasks to display.
The lessor of your number and available screen rows will be
used.
When used in alternate-display mode, this is the command that
gives you precise control over the size of each currently visi-
ble task display, except for the very last. It will not affect
the last window’s size, as all prior task displays will have
already been painted.
Note: If you wish to increase the size of the last visible task
display when in alternate-display mode, simply decrease the size
of the task display(s) above it.
SORTING of task window
For compatibility, this top supports most of the former top sort
keys. Since this is primarily a service to former top users, these
commands do not appear on any help screen.
command sorted field supported
A start time (non-display) No
M %MEM Yes
N PID Yes
P %CPU Yes
T TIME+ Yes
Before using any of the following sort provisions, top suggests that
you temporarily turn on column highlighting using the ’x’ interactive
command. That will help ensure that the actual sort environment
matches your intent.
The following interactive commands will only be honored when the cur-
rent sort field is visible. The sort field might not be visible
because:
1) there is insufficient Screen Width
2) the ’f’ interactive command turned it Off
´<´ :Move_Sort_Field_Left
Moves the sort column to the left unless the current sort field
is the first field being displayed.
´>´ :Move_Sort_Field_Right
Moves the sort column to the right unless the current sort field
is the last field being displayed.
The following interactive commands will always be honored whether or
not the current sort field is visible.
´F´ or ´O´ :Select_Sort_Field
These keys display a separate screen where you can change which
field is used as the sort column.
If a field is selected which was not previously being displayed,
it will be forced On when you return to the top display. How-
ever, depending upon your screen width and the order of your
fields, this sort field may not be displayable.
This interactive command can be a convenient way to simply ver-
ify the current sort field, when running top with column high-
lighting turned Off.
´R´ :Reverse/Normal_Sort_Field_toggle
Using this interactive command you can alternate between high-
to-low and low-to-high sorts.
Note: Field sorting uses internal values, not those in column dis-
play. Thus, the TTY and WCHAN fields will violate strict ASCII col-
lating sequence.
3d. COLOR Mapping
When you issue the ’Z’ interactive command, you will be presented with
a separate screen. That screen can be used to change the colors in
just the ´current’ window or in all four windows before returning to
the top display.
Available interactive commands
4 upper case letters to select a target
8 numbers to select a color
normal toggles available
’B’ :bold disable/enable
’b’ :running tasks "bold"/reverse
’z’ :color/mono
other commands available
’a’/’w’ :apply, then go to next/prior
:apply and exit
’q’ :abandon current changes and exit
If your use ’a’ or ’w’ to cycle the targeted window, you will have
applied the color scheme that was displayed when you left that window.
You can, of course, easily return to any window and reapply different
colors or turn colors Off completely with the ’z’ toggle.
The Color Mapping screen can also be used to change the ´current’ win-
dow/field group in either full-screen mode or alternate-display mode.
Whatever was targeted when ’q’ or was pressed will be made cur-
rent as you return to the top display.
4. ALTERNATE-DISPLAY Mode
4a. WINDOWS Overview
Field Groups/Windows:
In full-screen mode there is a single window represented by the
entire screen. That single window can still be changed to dis-
play 1 of 4 different field groups (see the ’G’ interactive com-
mand, repeated below). Each of the 4 field groups has a unique
separately configurable summary area and its own configurable
task area.
In alternate-display mode, those 4 underlying field groups can
now be made visible simultaneously, or can be turned Off indi-
vidually at your command.
The summary area will always exist, even if it’s only the mes-
sage line. At any given time only one summary area can be dis-
played. However, depending on your commands, there could be
from zero to four separate task displays currently showing on
the screen.
Current Window:
The ´current’ window is the window associated with the summary
area and the window to which task related commands are always
directed. Since in alternate-display mode you can toggle the
task display Off, some commands might be restricted for the
´current’ window.
A further complication arises when you have toggled the first
summary area line Off. With the loss of the window name (the
’l’ toggled line), you’ll not easily know what window is the
´current’ window.
4b. COMMANDS for Windows
´-´ and ´_´ :Show/Hide_Window(s)_toggles
The ’-’ key turns the ´current’ window’s task display On and
Off. When On, that task area will show a minimum of the columns
header you’ve established with the ’f’ and ’o’ commands. It
will also reflect any other task area options/toggles you’ve
applied yielding zero or more tasks.
The ’_’ key does the same for all task displays. In other
words, it switches between the currently visible task display(s)
and any task display(s) you had toggled Off. If all 4 task dis-
plays are currently visible, this interactive command will leave
the summary area as the only display element.
* ´=´ and ´+´ :Equalize_(re-balance)_Window(s)
The ’=’ key forces the ´current’ window’s task display to be
visible. It also reverses any ’i’ (idle tasks) and ’n’ (max
tasks) commands that might be active.
The ’+’ key does the same for all windows. The four task dis-
plays will reappear, evenly balanced. They will also have
retained any customizations you had previously applied, except
for the ’i’ (idle tasks) and ’n’ (max tasks) commands.
* ´A´ :Alternate_Display_Mode_toggle
This command will switch between full-screen mode and alter-
nate-display mode.
The first time you issue this command, all four task displays
will be shown. Thereafter when you switch modes, you will see
only the task display(s) you’ve chosen to make visible.
* ´a´ and ´w´ :Next_Window_Forward/Backward
This will change the ´current’ window, which in turn changes the
window to which commands are directed. These keys act in a cir-
cular fashion so you can reach any desired ´current’ window
using either key.
Assuming the window name is visible (you have not toggled ’l’
Off), whenever the ´current’ window name loses its empha-
sis/color, that’s a reminder the task display is Off and many
commands will be restricted.
* ´G´ :Choose_Another_Window/Field_Group
You will be prompted to enter a number between 1 and 4 designat-
ing the window/field group which should be made the ´current’
window.
In full-screen mode, this command is necessary to alter the
´current’ window. In alternate-display mode, it is simply a
less convenient alternative to the ’a’ and ’w’ commands.
´g´ :Change_Window/Field_Group_Name
You will be prompted for a new name to be applied to the ´cur-
rent’ window. It does not require that the window name be visi-
ble (the ’l’ toggle to be On).
* The interactive commands shown with an asterisk (’*’) have use
beyond alternate-display mode.
´=’, ’A’, ’G’ are always available
´a’, ’w’ act the same when color mapping
5. FILES
5a. SYSTEM Configuration File
The presence of this file will influence which version of the ’help’
screen is shown to an ordinary user. More importantly, it will limit
what ordinary users are allowed to do when top is running. They will
not be able to issue the following commands.
k Kill a task
r Renice a task
d or s Change delay/sleep interval
The system configuration file is not created by top. Rather, you cre-
ate this file manually and place it in the /etc directory. Its name
must be ’toprc’ and must have no leading ’.’ (period). It must have
only two lines.
Here is an example of the contents of /etc/toprc:
s # line 1: ’secure’ mode switch
5.0 # line 2: ’delay’ interval in seconds
5b. PERSONAL Configuration File
This file is written as ’$HOME/.your-name-4-top’ + ’rc’. Use the ’W’
interactive command to create it or update it.
Here is the general layout:
global # line 1: the program name/alias notation
" # line 2: id,altscr,irixps,delay,curwin
per ea # line a: winname,fieldscur
window # line b: winflags,sortindx,maxtasks
" # line c: summclr,msgsclr,headclr,taskclr
If the $HOME variable is not present, top will try to write the per-
sonal configuration file to the current directory, subject to permis-
sions.
6. STUPID TRICKS Sampler
Many of these ’tricks’ work best when you give top a scheduling boost.
So plan on starting him with a nice value of -10, assuming you’ve got
the authority.
6a. Kernel Magic
For these stupid tricks, top needs full-screen mode.
-*- The user interface, through prompts and help, intentionally
implies that the delay interval is limited to tenths of a second.
However, you’re free to set any desired delay. If you want to see
Linux at his scheduling best, try a delay of .09 seconds or less.
For this experiment, under x-windows open an xterm and maximize
it. Then do the following:
. provide a scheduling boost and tiny delay via:
nice -n -10 top -d.09
. keep sorted column highlighting Off to minimize
path length
. turn On reverse row highlighting for emphasis
. try various sort columns (TIME/MEM work well),
and normal or reverse sorts to bring the most
active processes into view
What you’ll see is a very busy Linux doing what he’s always done
for you, but there was no program available to illustrate this.
-*- Under an xterm using ’white-on-black’ colors, try setting top’s
task color to black and be sure that task highlighting is set to
bold, not reverse. Then set the delay interval to around .3 sec-
onds.
After bringing the most active processes into view, what you’ll
see are the ghostly images of just the currently running tasks.
-*- Delete the existing rcfile, or create a new symlink. Start this
new version then type ’T’ (a secret key, see topic 3c. TASK Area
Commands, Sorting) followed by ’W’ and ’q’. Finally, restart the
program with -d0 (zero delay).
Your display will be refreshed at three times the rate of the for-
mer top, a 300% speed advantage. As top climbs the TIME ladder,
be as patient as you can while speculating on whether or not top
will ever reach the top.
6b. Bouncing Windows
For these stupid tricks, top needs alternate-display mode.
-*- With 3 or 4 task displays visible, pick any window other than the
last and turn idle processes Off. Depending on where you applied
’i’, sometimes several task displays are bouncing and sometimes
it’s like an accordion, as top tries his best to allocate space.
-*- Set each window’s summary lines differently: one with no memory;
another with no states; maybe one with nothing at all, just the
message line. Then hold down ’a’ or ’w’ and watch a variation on
bouncing windows -- hopping windows.
-*- Display all 4 windows and for each, in turn, set idle processes to
Off. You’ve just entered the "extreme bounce" zone.
6c. The Big Bird Window
This stupid trick also requires alternate-display mode.
-*- Display all 4 windows and make sure that 1:Def is the ´current’
window. Then, keep increasing window size until the all the other
task displays are "pushed out of the nest".
When they’ve all been displaced, toggle between all visible/invis-
ible windows. Then ponder this:
is top fibbing or telling honestly your imposed truth?
7. BUGS
Send bug reports to:
Albert D. Cahalan,
The top command calculates Cpu(s) by looking at the change in CPU time
values between samples. When you first run it, it has no previous sam-
ple to compare to, so these initial values are the percentages since
boot. It means you need at least two loops or you have to ignore sum-
mary output from the first loop. This is problem for example for batch
mode. There is a possible workaround if you define the CPULOOP=1 envi-
ronment variable. The top command will be run one extra hidden loop for
CPU data before standard output.
8. HISTORY Former top
The original top was written by Roger Binns, based on Branko
Lankester’s ps program.
Robert Nation adapted it for the
proc file system.
Helmut Geyer added support for
configurable fields.
Plus many other individuals contributed over the years.
9. AUTHOR
This entirely new and enhanced replacement was written by:
Jim / James C. Warner,
With invaluable help from:
Albert D. Cahalan,
Craig Small,
10. SEE ALSO
free(1), ps(1), uptime(1), atop(1), slabtop(1), vmstat(8), w(1).
Linux September 2002 TOP(1)