procのヘルプ・マニュアル
日本語 英語
proc --help
man proc
PROC(5) Linux Programmer’s Manual PROC(5)
名前
proc - プロセスの情報を含む擬似ファイルシステム
説明
proc ファイルシステムは擬似的なファイルシステムであり、カーネル内のデー
タへのインターフェースとして使用される。一般的には /proc にマウントされ
る。大部分のファイルは読み出し専用 (read-only) であるが、いくつかのファ
イルは書き込み可能であり、そのファイルに書き込めばカーネルの内部変数 を
変更できる。
以下は /proc 階層の簡単なあらましである。
/proc/[pid]
実行中のプロセスについてのサブディレクトリ。サブディレクトリ名は
(そのプロセスの) プロセス ID である。各サブディレクトリは、以 下
の擬似ファイルとディレクトリを含む。
/proc/[number]/auxv (カーネル 2.6.0-test7 以降)
実 行時にプロセスに渡された ELF インタプリタ情報が格納されている
。個々のエントリは、unsigned long 型の ID 1 個に unsigned long
型 の 値 1 個が続くフォーマットである。最後のエントリには 0 が 2
個入っている。
/proc/[pid]/cmdline
プロセスの完全なコマンド行を保持する。ただし、そのプロセスがゾン
ビプロセスの場合は、このファイルは空となる。つまり、このファイル
を読み出しても一文字も返らない。このファイルではコマンドライン引
き数が、ヌル文字で区切られた文字列として書かれており、最後の文字
列の後にヌルバイト ('\0') が一つ置かれる。
/proc/[pid]/coredump_filter (kernel 2.6.23 以降)
core(5) 参照。
/proc/[pid]/cpuset (kernel 2.6.12 以降)
cpuset(7) 参照。
/proc/[pid]/cwd
プロセスのカレントワーキングディレクトリへのシンボリックリンク。
例えば、プロセス 20 のカレントワーキングディレクトリを見つけるた
めには、次のようにすればよい。
$ cd /proc/20/cwd; /bin/pwd
pwd コマンドはシェルの内部コマンドのことがよくあり、うまく動作し
ないかもしれない。 bash(1) では pwd -P を使ってもよい。
マルチスレッドプロセスでは、メインスレッドがすでに終了している場
合、このシンボリックリンクの内容は参照できない (スレッドの終了は
通常 pthread_exit(3) を呼び出しにより行われる)。
/proc/[pid]/environ
こ のファイルはプロセスの環境変数を含んでいる。各エントリは NULL
バイト ('\0') で区切られていて、末尾に NULL バイトがあるかもしれ
な い。したがって、プロセス 1 の環境変数を表示するためには次のよ
うにすればよい。
$ (cat /proc/1/environ; echo) | tr '\000' '\n'
/proc/[pid]/exe
Linux 2.2 以降では、このファイルはシンボリックリンクで、実行可能
コマンドの実際のパス名を格納している。このシンボリックリンクは通
常のように辿ることができる; これをオープンすると実行可能ファイル
がオープンされる。 (コマンドラインで) /proc/[pid]/exe と入力する
と、プロセス番号 [pid] で実行されている実行可能ファイルをもう 一
つ実行することができる。マルチスレッドプロセスでは、メインスレッ
ドがすでに終了している場合、このシンボリックリンクの内容は参照で
き ない (スレッドの終了は通常 pthread_exit(3) を呼び出しにより行
われる)。
Linux 2.0 以前では、 /proc/[pid]/exe は実行されたバイナリへの ポ
イ ンタで、シンボリックリンクのように見える。 Linux 2.0 以前では
、このファイルに対して readlink(2) を実行すると、
[デバイス番号]:iノード番号
というフォーマットの文字列が返る。
たとえば、[0301]:1502 はメジャーデバイス番号 03 (IDE, MFM などの
ド ライブ) マイナーデバイス番号 01 (最初のドライブの最初のパーテ
ィション) のデバイス上の iノード番号 1502 である。
-inum オプションをつけて find(1) を使うと、このファイルの所在 を
探すことができる。
/proc/[pid]/fd
プロセスがオープンしたファイル各々に対するエントリを含むサブディ
レクトリ。ファイルディスクリプタがファイル名で、実際のファイルへ
の シンボリックリンクになっている。したがって 0 は標準入力、1 は
標準出力、2 は標準エラー出力、などとなる。
マルチスレッドプロセスでは、メインスレッドがすでに終了している場
合 、 このディレクトリの内容は参照できない (スレッドの終了は通常
pthread_exit(3) を呼び出しにより行われる)。
コマンドライン引き数としてファイル名を受け取るが、引き数が渡され
なかった場合に標準入力から入力を受け取らないようなプログラムや、
コマンドライン引き数として書き込みファイルを受け取るが、引き数が
渡されなかった場合に標準出力に出力を行わないようなプログラムであ
っても、 /proc/[pid]/fd を使うことで標準入力や標準出力を使用でき
るようになる。例えば、 -i を入力ファイルを指定するフラグ、 -o を
出力ファイルを指定するフラグと仮定すると、以下のコマンドを実行す
ることにより、フィルタとして動作させることができる。
$ foobar -i /proc/self/fd/0 -o /proc/self/fd/1 ...
/proc/self/fd/N は 、 ある種の Unix や Unix 風のシステムにある
/dev/fd/N とだいたい同じである。事実 Linux のたいていの MAKEDEV
スクリプトは、 /dev/fd を /proc/self/fd へのシンボリックリンクに
している。
ほとんどのシステムでは、シンボリックリンク /dev/stdin, /dev/std-
out, /dev/stderr が提供されており、それぞれ /proc/self/fd 内のフ
ァイル 0, 1, 2 にリンクされている。したがって、上述のサンプル コ
マンドは次のようにも書くことができる。
$ foobar -i /dev/stdin -o /dev/stdout ...
/proc/[pid]/fdinfo/ (kernel 2.6.22 以降)
このサブディレクトリには、そのプロセスがオープンしているファイル
毎のエントリが入っており、ファイルディスクリプタがファイル名とな
っている。各ファイルの内容を読み出すことで、対応するファイルディ
スクリプタに関する情報を得ることができる。以下に例を示す。
$ cat /proc/12015/fdinfo/4
pos: 1000
flags: 01002002
pos フィールドは 10 進数で、現在のファイルオフセット を 示 す 。
flags フィールドは 8 進数で、ファイルのアクセスモードとファイル
状態フラグを示す (open(2) 参照)。
このディレクトリのファイルは、プロセスの所有者だけが読み出すこと
ができる。
/proc/[pid]/limits (kernel 2.6.24 以降)
このファイルは、そのプロセスの各リソース制限について、ソフト・リ
ミット、ハード・リミット、計測単位を表示する (getrlimit(2) 参照)
。 このファイルは、プロセスの実 UID を持つものだけが読み出すこと
ができる。
/proc/[pid]/maps
現在マップされているメモリ領域とそのアクセスパーミッションを含む
。
フォーマットは以下のとおり:
address perms offset dev inode pathname
08048000-08056000 r-xp 00000000 03:0c 64593 /usr/sbin/gpm
08056000-08058000 rw-p 0000d000 03:0c 64593 /usr/sbin/gpm
08058000-0805b000 rwxp 00000000 00:00 0
40000000-40013000 r-xp 00000000 03:0c 4165 /lib/ld-2.2.4.so
40013000-40015000 rw-p 00012000 03:0c 4165 /lib/ld-2.2.4.so
4001f000-40135000 r-xp 00000000 03:0c 45494 /lib/libc-2.2.4.so
40135000-4013e000 rw-p 00115000 03:0c 45494 /lib/libc-2.2.4.so
4013e000-40142000 rw-p 00000000 00:00 0
bffff000-c0000000 rwxp 00000000 00:00 0
こ こで "address" はプロセスのアドレス空間でそのメモリ領域が占め
ているアドレスで、"perms" はパーミッションのセットである。
r = read
w = write
x = execute
s = shared
p = private (copy on write)
"offset" はファイル (などの) 中でのオフセット、 "dev" はデバイス
(メジャーデバイス番号:マイナーデバイス番号)、 "inode" はそのデバ
イスの i ノード番号である。これが 0 のときは、bss (初期化され て
い ないデータ領域) の場合のようにこのメモリ領域にはどの i ノード
も割り当てられていないことを意味している。
Linux 2.0 ではパス名を書いたフィールドがない。
/proc/[pid]/mem
このファイルは、 open(2), read(2), lseek(2) を通して、プロセスの
メモリのページにアクセスするために使われる。
/proc/[pid]/mountinfo (Linux 2.6.26 以降)
このファイルには、マウントポイントについての情報が入っている。以
下のような形式の行から構成される。
36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue
(1)(2)(3) (4) (5) (6) (7) (8) (9) (10) (11)
括弧付きの数字は、以下の説明のためのものである。
(1) マウント ID: マウントの一意な識別子 (umount(2) の後は再利用
されるかもしれない)。
(2) parent ID: 親マウントの ID (マウントツリーの最上位の場合は
自分自身の ID となる)。
(3) major:minor: ファイルシステム上のファイルの st_dev の 値
(stat(2) 参照)。
(4) ルート: そのファイルシステム内のマウントのルート。
(5) マウントポイント: マウントポイントのそのプロセスのルートか
らの相対パス。
(6) マウントオプション: 各マウントのオプション。
(7) オプションフィールド: "tag[:value]" 形式のフィールドが 0 個
以上並ぶ。
(8) セパレータ: オプションフィールドの終わりを示す。
(9) ファイルシステム種別: ファイルシステムの名前。 "type[.sub-
type]" という形式となる。
(10) マウント元: ファイルシステム固有の情報。ない場合 は "none"
となる。
(11) super options: スーパーブロック単位のオプション。
解釈する側は認識できないオプションフィールドは全て無視すべきであ
る。現在のところ、オプションフィールドとしては以下のようなものが
ある。
shared:X マウントはピアグループ (peer group) X で
共有されている。
master:X マウントはピアグループ (peer group) X の
スレーブである。
propagate_from:X マウントはスレーブであり、ピアグループ X
(*) から mount propagation を受信する。
unbindable マウントは unbind できない。
(*) X は、プロセスの root で直近の dominant peer group である 。
X がマウントの直接のマスターである場合や、同じ root に dominant
peer group がない場合は、 "master:X" フィールドだけが存 在 し 、
"propagate_from:X" フィールドは存在しない。
mount propagation の 詳細については、カーネルソースツリー内の
Documentation/filesystems/sharedsubtree.txt を参照。
/proc/[pid]/mounts (Linux 2.4.19 以降)
そのプロセスのマウント名前空間に現在マウントされている全ファイル
システムのリスト。このファイルのフォーマットは fstab(5) に載って
いる。カーネル 2.6.15 以降では、このファイルを監視することができ
る (pollable)。このファイルを読み出し用にオープンした後で、この
ファイルに変更があると (つまりファイルシステムのマウントやアンマ
ウントがあると)、 select(2) ではそのファイルディスクリプタは読み
出し可能となり、 poll(2) と epoll_wait(2) ではそのファイルはエラ
ー状態として通知される。
/proc/[pid]/mountstats (Linux 2.6.17 以降)
このファイルを通じて、そのプロセスの名前空間内のマウントポイント
に関する各種情報 (統計、設定情報) を参照できる。ファイルの各行は
以下のフォーマットである。
device /dev/sda7 mounted on /home with fstype ext3 [statistics]
( 1 ) ( 2 ) (3 ) (4)
各行のフィールドは以下の通りである。
(1) マウントされているデバイス名 (対応するデバイスがない場合は
"nodevice" となる)。
(2) マウントポイントのファイルシステムツリーにおけるパス名。
(3) ファイルシステム種別。
(4) 追加の統計や設定情報。現在のところ (Linux 2.6.26 時点で は)
、このフィールドで情報が提供されているのは NFS ファイルシス
テムだけである。
このファイルはプロセスの所有者だけが読み出すことができる。
/proc/[pid]/numa_maps (Linux 2.6.14 以降)
numa(7) を参照。
/proc/[pid]/oom_adj (Linux 2.6.11 以降)
このファイルは、メモリ不足 (OOM) の状況下でどのプロセスを殺す べ
きかを選択するのに使用されるスコアを調整するのに使用される。カー
ネルは、プロセスの oom_score 値のビットシフト操作に、この値を 使
用する。この値として有効な値は -16 から +15 までと、特別な意味を
持つ -17 である。 -17 はそのプロセスに対する OOM-killing を完 全
に 無 効 に す ることを意味する。正の値ほど、そのプロセスが OOM-
killer により殺される可能性が高くなり、負の値ほど可能性が低く な
る 。このファイルのデフォルト値は 0 である。新しいプロセスは親プ
ロセスの oom_adj の設定を継承する。このファイルを変更するため に
は、プロセスは特権 (CAP_SYS_RESOURCE) を持っていなければならない
。
/proc/[pid]/oom_score (Linux 2.6.11 以降)
このファイルは、OOM-killer のプロセス選択用として、カーネルが こ
のプロセスに対して与えた現在のスコアを表示する。高いスコアは、そ
のプロセスが OOM-killer により選択される可能性が高いことを意味す
る。このスコアの基本はそのプロセスが使用しているメモリ量であり、
以下の要因により加算 (+) 減算 (-) が行われる。
* そのプロセスが多くの子プロセスを fork(2) を使って作成してい る
か (+)。
* そのプロセスが長時間実行されて来たか、もしくは多くの CPU 時間
を使用しているか (-)。
* そのプロセスが低い nice 値 (> 0) を持っているか (+)。
* そのプロセスが特権を持っているか (-)。
* そのプロセスが direct hardware access を行っているか (-)。
oom_score は、そのプロセスの oom_adj 設定で規定されるビットシ フ
ト調整にも影響を与える。
/proc/[pid]/root
Unix と Linux では、ファイルシステムのルート (/) をプロセスごと
に別々にできる。これはシステムコール chroot(2) によって設定す る
。このファイルはプロセスのルートディレクトリを指すシンボリックリ
ンクで、 exe や fd/* などと同じような動作をする。
マルチスレッドプロセスでは、メインスレッドがすでに終了している場
合、このシンボリックリンクの内容は参照できない (スレッドの終了は
通常 pthread_exit(3) を呼び出しにより行われる)。
/proc/[pid]/smaps (Linux 2.6.14 以降)
このファイルは、そのプロセスの各マッピングのメモリ消費量を表示す
る。マッピングのそれぞれについて、以下のような内容が表示される。
08048000-080bc000 r-xp 00000000 03:02 13130 /bin/bash
Size: 464 kB
Rss: 424 kB
Shared_Clean: 424 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 0 kB
最初の行には、 /proc/[pid]/maps で表示されるマッピングと同じ情報
が 表示される。残りの行には、マッピングのサイズ、現在 RAM 上に存
在するマッピングの量、マッピング内の共有ページのうちクリーンなペ
ージ数、ダーティなページ数、マッピング内のプライベートページのう
ちクリーンなページ数、ダーティなページ数、を示す。
このファイルが存在するのは、カーネルのコンフィギュレーション・オ
プション CONFIG_MMU を有効にした場合だけである。
/proc/[pid]/stat
プ ロ セ ス の 状 態 に つ い て の情報。これは ps(1) で使われ、
/usr/src/linux/fs/proc/array.c で定義されている。
各フィールドを順番に、 scanf(3) のフォーマット指定子付きで以下に
示す。
pid %d プロセス ID。
comm %s 括弧でくくられた実行形式のファイル名。実行形式がスワ
ップアウトされているかどうかによらず、見ることができ
る。
state %c "RSDZTW" のどれか 1 文字。 R は実行中 (running)、 S
は割り込み可能な休眠状態 (sleeping in an interrupt-
ible wait)、 D は割り込み不可能なディスクスリープの
待機状態 (waiting in uninterruptible disk sleep)、 Z
は ゾ ン ビ 状 態 (zombie)、 T はトレースされている
(traced) か (シグナルにより) 停 止 し て い る 状 態
(stopped)、 W はページング中 (paging) を表している。
ppid %d 親プロセスの PID。
pgrp %d プロセスのプロセスグループ ID。
session %d プロセスのセッション ID。
tty_nr %d プロセスの制御端末 (マイナー・デバイス番号はビ ッ ト
31 〜20 と 7〜0 にまたがって格納され、メジャー・デバ
イス番号はビット 15〜8 に格納される)。
tpgid %d プロセスの制御端末のフォアグランド・プロセス・グルー
プの ID。
flags %u (Linux 2.6.22 より前は %lu)
プ ロ セ ス のカーネルフラグワード。ビットの意味は、
で定義されている PF_* を参照すること
。詳細はカーネルのバージョンに依存する。
minflt %lu プ ロ セ ス が引き起こしたマイナーフォールト (minor
fault、ディスクからメモリページへのロードを必要と し
ないフォールト) の回数。
cminflt %lu ( そのプロセスが終了を待っている) 子プロセスが引き起
こしたマイナーフォールトの回数。
majflt %lu プロセスが引き起こしたメジャーフ ォ ー ル ト (major
fault 、ディスクからメモリページへのロードを必要とす
るフォールト) の回数。
cmajflt %lu (そのプロセスが終了を待っている) 子プロセスが引き 起
こしたメジャーフォールトの回数。
utime %lu このプロセスがユーザーモードでスケジューリングされた
時間の合計 。 clock tick 単 位 で 計 測 さ れ る
(sysconf(_SC_CLK_TCK) で割った値が表示される)。この
値にはゲスト時間 guest_time (仮想 CPU の実行に消費さ
れた時間) も含まれる。これは、ゲスト時間のフィールド
を認識しないアプリケーションにおいて、ゲスト時間分を
計算に入れ損ねないようにするためである。
stime %lu プロセスのカーネルモードでの実行時間 (単位 jiffies)
。このプロセスがカーネルモードでスケジューリングされ
た 時 間 の 合 計 。 clock tick 単位で計測される
(sysconf(_SC_CLK_TCK) で割った値が表示される)。
cutime %ld このプロセスの子プロセスで、終了待ち (waited-for) の
プロセスが、ユーザモードでスケジューリングされた時間
の 合 計 。 clock tick 単 位 で 計 測 さ れ る
(sysconf(_SC_CLK_TCK) で 割 っ た値が表示される)。
(times(2) も参照すること。) この値にはゲ ス ト 時 間
cguest_time (仮想 CPU を実行するのに消費した時間、下
記参照) も含まれる。
cstime %ld このプロセスの子プロセスで、終了待ち (waited-for) の
プロセスが、カーネルモードでスケジューリングされた時
間の 合 計 。 clock tick 単 位 で 計 測 さ れ る
(sysconf(_SC_CLK_TCK) で割った値が表示される)。
priority %ld
(Linux 2.6 の場合の説明) リアルタイム・スケジューリ
ングポリシー (下記の policy ; sched_setscheduler(2)
参照) で動作しているプロセスでは、この値はスケジュー
リング優先度を反転した値 (スケジューリング優先度をマ
イナスにした値) となる。値は -2 から -100 までの範囲
の数値で、それぞれリアルタイム優先度の 1 から 9 に対
応する。リアルタイム以外のスケジューリングポリシーで
動作しているプロセスでは、この値はカーネル内で管理さ
れている nice 値そのもの (setpriority(2)) となる。カ
ーネルは nice 値を 0 (高) から 39 (低) の範囲の値 と
し て 保持しており、それぞれユーザに見える nice 値の
-20 から 19 に対応する。
Linux 2.6 より前では、このプロセスに割り当てられたス
ケジューリング重みを変換した値が表示されていた。
nice %ld nice 値 (setpriority(2) 参照)。 19 (最低優先) から
-20 (最高優先) の範囲の値である。
num_threads %ld
このプロセスのスレッド数 (Linux 2.6 以降)。カーネ ル
2.6 より前では、このフィールドは削除されたフィールド
の場所埋めとして 0 にハードコードされていた。
itrealvalue %ld
インターバルタイマによって、次に SIGALRM がプロセ ス
へ送られるまでの時間 (単位 jiffies)。カーネル 2.6.17
以降では、このフィールドはメンテナンスされなくなり、
0 にハードコードされている。
starttime %llu (Linux 2.6 より前は %lu)
プロセスの起動時刻。システムが起動した時刻が起点 (単
位 jiffies)。
vsize %lu 仮想メモリのサイズ。単位はバイト。
rss %ld Resident Set Size。プロセスが持っている実メモリ上 の
ページ数。これはちょうどテキスト、データ、スタック空
間に使われているページ数である。デマンドロードされて
いないページやスワップアウトされたページの数は含んで
いない。
rsslim %lu このプロセスの rss の現在のソフト・リミット (バイ ト
単位)。 getpriority(2) の RLIMIT_RSS の説明を参照。
startcode %lu
プログラムテキストが実行可能であるような領域の先頭ア
ドレス。
endcode %lu プログラムテキストが実行可能であるような領域の末尾ア
ドレス。
startstack %lu
スタックの開始アドレス (すなわち、スタックの底)。
kstkesp %lu 現在の ESP (スタックポインタ) の値。プロセスのカーネ
ルスタックページにある。
kstkeip %lu 現在の EIP (インストラクションポインタ) の値。
signal %lu 処理待ちのシグナルのビットマップ。 10 進数で表示され
る。このフィールドは廃止予定である。リアルタイム・シ
グナルに関する情報は表示されないからである。代わりに
/proc/[pid]/status を使うこと。
blocked %lu ブロックされた (blocked) シグナルのビットマップ。 10
進数で表示される。このフィールドは廃止予定である。リ
アルタイム・シグナルに関する情報は表示されないからで
ある。代わりに /proc/[pid]/status を使うこと。
sigignore %lu
無視された (ignored) シグナルのビットマップ。 10 進
数で表示される。このフィールドは廃止予定である。リア
ルタイム・シグナルに関する情報は表示されないからであ
る。代わりに /proc/[pid]/status を使うこと。
sigcatch %lu
捕捉された (caught) シグナルのビットマップ。 10 進数
で表示される。このフィールドは廃止予定である。リアル
タイム・シグナルに関する情報は表示されないからである
。代わりに /proc/[pid]/status を使うこと。
wchan %lu プロセスが待っている「チャネル」。これはシステムコー
ルのアドレスであり、文字名が必要ならば (アドレスとシ
ステムコール名との) 対応表から見つけられ る ( も し
/etc/psdatabase [訳注: このファイル名はパッケージに
よる] を更新しているならば、 ps -l して WCHAN フィー
ルドを見よ)。
nswap %lu スワップされたページ数 (メンテナンスされていない)。
cnswap %lu 子プロセスの nswap の累計 (メンテナンスされていない)
。
exit_signal %d (Linux 2.1.22 以降)
プロセスが死んだときに親プロセスに送られるシグナル。
processor %d (Linux 2.2.8 以降)
このプロセスを最後に実行した CPU の番号。
rt_priority %u (Linux 2.5.19 以降; Linux 2.6.22 より前は %lu)
リアルタイム・スケジューリングの優先度。リアルタイム
・ポリシーの元でスケジューリングされるプロセスでは 1
から 99 の範囲の値となり、リアルタイム以外のスケジュ
ーリングポリシ ー の プ ロ セ ス で は 0 と な る
(sched_setscheduler(2) 参照)。
policy %u (Linux 2.5.19 以降; Linux 2.6.22 より前は %lu)
スケジューリング・ポリシー (sched_setscheduler(2) 参
照)。値は、 linux/sched.h の SCHED_* 定数を使って デ
コードすればよい。
delayacct_blkio_ticks %llu (Linux 2.6.18 以降)
(clock tick (100分の1秒) 単位での) ブロック I/O の総
遅延量。
guest_time %lu (Linux 2.6.24 以降)
プロセスのゲスト時間 (ゲスト OS の仮想 CPU を実行 す
る のに消費された時間)。 clock tick 単位で計測される
(sysconf(_SC_CLK_TCK) で割った値が表示される)。
cguest_time %ld (Linux 2.6.24 以降)
プロセスの子プロセスのゲスト時間。 clock tick 単位で
計 測される (sysconf(_SC_CLK_TCK) で割った値が表示さ
れる)。
/proc/[pid]/statm
(ページ単位で計測した) メモリ使用量についての情報を提供する。 各
列は以下の通りである。
size プログラムサイズの総計
(/proc/[pid]/status の VmSize と同じ)
resident 実メモリ上に存在するページ
(/proc/[pid]/status の VmRSS と同じ)
share 共有ページ (共有マッピングされているページ)
text テキスト (コード)
lib ライブラリ (Linux 2.6 では未使用)
data データ + スタック
dt ダーティページ (Linux 2.6 では未使用)
/proc/[pid]/status
/proc/[pid]/stat と /proc/[pid]/statm にある多くの情報を、人間が
解析しやすい形式で提供する。以下に例を示す。
$ cat /proc/$$/status
Name: bash
State: S (sleeping)
Tgid: 3515
Pid: 3515
PPid: 3452
TracerPid: 0
Uid: 1000 1000 1000 1000
Gid: 100 100 100 100
FDSize: 256
Groups: 16 33 100
VmPeak: 9136 kB
VmSize: 7896 kB
VmLck: 0 kB
VmHWM: 7572 kB
VmRSS: 6316 kB
VmData: 5224 kB
VmStk: 88 kB
VmExe: 572 kB
VmLib: 1708 kB
VmPTE: 20 kB
Threads: 1
SigQ: 0/3067
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000010000
SigIgn: 0000000000384004
SigCgt: 000000004b813efb
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: ffffffffffffffff
Cpus_allowed: 00000001
Cpus_allowed_list: 0
Mems_allowed: 1
Mems_allowed_list: 0
voluntary_ctxt_switches: 150
nonvoluntary_ctxt_switches: 545
フィールドの詳細は以下の通りである。
* Name: このプロセスにより実行されたコマンド。
* State: プロセスの現在の状態。 "R (running; 実 行 中)", "S
(sleeping; 休 眠状態)", "D (disk sleep; ディスク待ちの休眠状
態)", "T (stopped; 停止状態)", "T (tracing stop; トレースに よ
る 停止)", "Z (zombie; ゾンビ状態)", "X (dead; 死亡)" のいずれ
かである。
* Tgid: スレッドグループ ID (すなわち、プロセス ID)。
* Pid: スレッド ID (gettid(2) 参照)。
* TracerPid: このプロセスをトレースしているプロセスの PID (ト レ
ースされていない場合は 0)。
* Uid, Gid: 実 UID/GID、実効 UID/GID、保存 set-UID/GID、ファイル
システム UID/GID。
* FDSize: 現在割り当てられているファイルディスクリプタのスロット
数。
* Groups: 補助グループのリスト。
* VmPeak: 仮想メモリサイズのピーク値。
* VmSize: 仮想メモリサイズ。
* VmLck: ロックされているメモリサイズ。
* VmHWM: 実メモリ上に存在するページサイズ (resident set size) の
ピーク値 ("high water mark")。
* VmRSS: 実メモリ上に存在するページサイズ。
* VmData, VmStk, VmExe: データ、スタック、テキストセグメントのサ
イズ。
* VmLib: 共有ライブラリ・コードのサイズ。
* VmPTE: ページ・テーブル・エントリのサイズ (Linux 2.6.10 以降)
。
* Threads: このスレッドが属するプロセスのスレッド数。
* SigPnd, ShdPnd: スレッド宛およびプロセス全体宛の処理待ちシグナ
ルの数 (pthreads(7), signal(7) 参照)。
* SigBlk, SigIgn, SigCgt: ブロックされるシグナル、無視されるシグ
ナル、捕捉待ちのシグナルを示すマスク値 (signal(7))。
* CapInh, CapPrm, CapEff: 継 承 可 能 (inheritable) 、 許 可
(permitted)、実効 (effective) の各ケーパビリティセットで有効に
なっているケーパビリティのマスク値 (capabilities(7) 参照)。
* CapBnd: ケーパビリティ・バウンディングセット (カーネル 2.6.26
以降、 capabilities(7) 参照)。
* Cpus_allowed: このプロセスが実行を許可されている CPU のマスク
値 (Linux 2.6.24 以降、 cpuset(7) 参照)。
* Cpus_allowed_list: 前項と同じだが、「リスト形式 」 で の 表 示
(Linux 2.6.26 以降、 cpuset(7) 参照)。
* Mems_allowed: このプロセスが使用できるメモリノードのマスク値
(Linux 2.6.24 以降、 cpuset(7) 参照)。
* Mems_allowed_list: 前項と同じだが、「リスト形式 」 で の 表 示
(Linux 2.6.26 以降、 cpuset(7) 参照)。
* voluntary_context_switches, nonvoluntary_context_switches: 自
発的/非自発的なコンテキストスイッチの回数 (Linux 2.6.23 以 降)
。
/proc/[pid]/task (Linux 2.6.0-test6 以降)
このディレクトリには、そのプロセスのスレッド情報を含むサブディレ
クトリが 1 スレッドにつき 1 つ置かれる。各サブディレクトリの名前
はスレッドのスレッド ID ([tid]) を示す数字である (gettid(2) を参
照)。これらの各サブディレクトリには、 /proc/[pid] ディレクトリ以
下と同じ名前と内容のファイル群がある。すべてのスレッドで共有され
る属性の場合、 task/[tid] サブディレクトリ以下の各ファイルの内容
は 親ディレクトリ /proc/[pid] の対応するファイルと同じになること
だろう (例えば、マルチスレッ ド ・ プ ロ セ ス で は フ ァ イ ル
task/[tid]/cwd はいずれも親ディレクトリ内の /proc/[pid]/cwd と同
じ値を持つことになる。なぜなら、一つのプロセスに属すすべてのスレ
ッ ドは作業ディレクトリを共有するからである)。スレッド毎に独立な
属性の場合、 task/[tid] サブディレクトリ以下の各ファイルは異なる
値 を持つことがある (例えば、ファイル task/[tid]/status はスレッ
ド毎に異なる値を持つ可能性がある)。
マルチスレッドプロセスでは、メインスレッドがすでに終了している場
合、 /proc/[pid]/task ディレクトリの内容は参照できない (スレッド
の終了は通常 pthread_exit(3) を呼び出しにより行われる)。
/proc/apm
Advanced Power Management のバージョンとバッテリ情報。カーネルの
コンパイル時に CONFIG_APM を定義したときに存在する。
/proc/bus
インストールされている各バス用にサブディレクトリがある。
/proc/bus/pccard
PCMCIA デバイスの情報が書かれるサブディレクトリ。カーネルのコン
パイル時に CONFIG_PCMCIA を定義したときに存在する。
/proc/bus/pccard/drivers
/proc/bus/pci
いくつかのサブディレクトリがあり、 PCI バス・インストールされ て
いるデバイス・デバイスドライバの情報が書かれた仮想ファイルがある
。これらのファイルのうちいくつかは ASCII フォーマットではない。
/proc/bus/pci/devices
PCI デバイスの情報。 lspci(8) や setpci(8) でアクセスすること が
できる。
/proc/cmdline
ブ ート時に Linux カーネルに渡された引き数。引き数の受け渡しは、
たいてい lilo(8) や grub(8) といったブートマネージャを使って行わ
れる。
/proc/config.gz (Linux 2.6 以降)
このファイルでは、現在実行中のカーネルの構築時に使用された設定オ
プションを参照できる。書式は、 (make xconfig, make config などを
使 って) カーネルの設定を変更した際に生成される .config ファイル
のものと同じである。ファイルの内容は圧縮されてお り 、 zcat(1),
zgrep(1) などを使うと、表示や検索ができる。ファイルが変更されて
いない限り、 /proc/config.gz の内容は次のコマンドで得られる内 容
と同じである。
cat /lib/modules/$(uname -r)/build/.config
/proc/config.gz が提供されるのは、カーネルの設定で CONFIG_IKCON-
FIG_PROC が有効になっている場合のみである。
/proc/cpuinfo
このファイルは、CPU およびシステムアーキテクチャに依存する項目を
集めたもので、リストの内容はサポートされているアーキテクチャ毎に
異なる。 2 つだけ共通の項目がある。 processor はプロセッサ番号で
、 bogomips はカーネルの初期化時に計算されるシステム定数である。
SMP マシンでは各 CPU についての情報が書かれている。
/proc/devices
メジャーデバイス番号とデバイスグループのテキスト形式のリス ト 。
MAKEDEV スクリプトはこのファイルを使って、カーネルとの整合性を保
つことができる。
/proc/diskstats (Linux 2.5.69 以降)
このファイルには各ディスクデバイスのディスク I/O 統計情報が書 か
れ て い る。更に詳しい情報は、カーネルソースファイル Documenta-
tion/iostats.txt を参照すること。
/proc/dma
登録されている ISA DMA (direct memory access) チャネルのリスト。
/proc/driver
空のサブディレクトリ。
/proc/execdomains
実行ドメインのリスト (ABI パーソナリティ)。
/proc/fb
カ ーネルのコンパイル時に CONFIG_FB が定義されている場合、フレー
ムバッファの情報が書かれる。
/proc/filesystems
カーネルが対応しているファイルシステムのテキスト形式のリスト。カ
ーネルに組み込まれてコンパイルされたファイルシステムと、カーネル
モジュールが現在ロードされているファイルシステムが列 挙 さ れ る
(filesystems(5) 参照)。ファイルシステムに "nodev" という印が付い
ている場合、そのファイルシステムがマウントするためのブロックデバ
イスを必要としないことを意味する (例えば、仮想ファイルシステム、
ネットワークファイルシステムなど)。
ちなみに、マウント時にファイルシステムが指定されず、どうやっても
フ ァ イ ル システムの種類を判定できなかった際に、このファイルを
mount(8) が使用するかもしれない。その場合、このファイルに含ま れ
るファイルシステムが試される (ただし、"nodev" の印がついたものは
除く)。
/proc/fs
空のサブディレクトリ。
/proc/ide
このディレクトリは IDE バスをもつシステムに存在する。各 IDE チャ
ネルとそれに取り付けられている各デバイスごとにディレクトリがあり
、以下のファイルが含まれている。
cache バッファサイズ (KB)
capacity セクタ数
driver ドライバのバージョン
geometry 物理ジオメトリと論理ジオメトリ
identify 16 進数表記
media メディアのタイプ
model 製造者のモデル番号
settings ドライブの設定
smart_thresholds 16 進数表記
smart_values 16 進数表記
hdparm(8) ユーティリティは、分かりやすい形式でこの情報にアクセス
するための手段を提供する。
/proc/interrupts
IO デ バ イス毎の CPU 別の割り込み回数の記録に使われる。 Linux
2.6.24 以降、少なくとも i386 と x86_64 アーキテクチャでは、 ( デ
バイスと関連がない) システム内部の割り込みについても記録される。
システム内部の割り込みには 、NMI (nonmaskable interrupt), LOC
(local timer interrupt) や 、SMP システムでは TLB (TLB flush
interrupt), RES (rescheduling interrupt), CAL (remote function
call interrupt) などがある。簡単に読むことのできるフォーマットで
、ASCII で表記されている。
/proc/iomem
Linux 2.4 における I/O メモリマップ。
/proc/ioports
現在登録され使われている I/O ポート領域のリスト。
/proc/kallsyms (Linux 2.5.71 以降)
カーネルの外部シンボル定義を保持する。 modules(X) 関係のツールが
ローダブルモジュールを動的にリンクしたりバインド (bind) するのに
使われる。 Linux 2.5.47 以前では、微妙に異なる書式の似たようなフ
ァイルが ksyms という名前であった。
/proc/kcore
こ のファイルはシステムの物理メモリを表現しており、 ELF コアファ
イル形式 (core file format) で保持されている。この擬似ファイルと
strip されていないカーネルのバイナリ (/usr/src/linux/vmlinux) [
訳注: パッケージに依存する]) があれば、 GDB はカーネル内の任意の
データ構造の現在の状態を調べられる。
このファイルの大きさは物理メモリ (RAM) のサイズに 4KB を加えた値
である。
/proc/kmsg
このファイルは syslog(2) システムコールでカーネルメッセージを 読
み出す代りに使える。プロセスがこのファイルを読むためにはスーパー
ユーザー権限が必要であり、ファイルを読み出すのは 1 つのプロセ ス
の みに限るべきである。カーネルメッセージを記録するために、 sys-
log(2) システムコールの機能を使う syslog プロセスが稼働してい る
場合、このファイルを読み出すべきではない。
このファイルの中の情報は dmesg(8) によって表示される。
/proc/ksyms (Linux 1.1.23-2.5.47)
/proc/kallsyms を参照。
/proc/loadavg
こ のファイルの最初の 3 つのフィールドはロードアベレージの数値で
、 1, 5, 15 分あたりの実行キュー内 (state R) またはディスク I/O
待ち (state D) のジョブ数を与える。これは uptime(1) などのプログ
ラムによって得られる値と同じである。 4 番目のフィールドはスラ ッ
シュ (/) で区切られた 2 つの数値から構成される。この数値のうち最
初のものは、現在実行されているカーネルスケジュールエンティティ (
プ ロセス、スレッド) の数である。この数値は CPU の数以下になる。
スラッシュの後の数値は、現在システム上に存在するカーネルスケジュ
ー ルエンティティの数である。 5 番目のフィールドはシステム上に最
も最近生成されたプロセスの PID である。
/proc/locks
このファイルは現在のファイルロック (flock(2) と fcntl(2)) とリー
ス (fcntl(2)) を表示する。
/proc/malloc (Linux 2.2 以前のみ)
コ ンパイルのときに CONFIGDEBUGMALLOC が定義されているときのみ、
このファイルは存在する。
/proc/meminfo
このファイルはシステム上のメモリ使用量に関する統計情報を表示する
。 free(1) は、このファイルを参照し、システムの未使用および使用
中のメモリ量 (物理メモリとスワップ) と、カーネルに使われている共
有メモリとバッファの情報を報告する。
/proc/modules
現在システムにロードされているモジュールのテキスト形式のリスト。
lsmod(8) も参照。
/proc/mounts
カーネル 2.4.19 より前では、このファイルは現在システムにマウント
さ れている全てのファイルシステムのリストであった。 Linux 2.4.19
でプロセス単位のマウント名前空間が導入されたことに伴い、このファ
イ ルは /proc/self/mounts へのリンクとなった。 /proc/self/mounts
はそのプロセス自身のマウント名前空間のマウントポイントのリストで
ある。このファイルのフォーマットは fstab(5) に記述されている。
/proc/mtrr
Memory Type Range Registers。詳細は、カーネルソースファイル Doc-
umentation/mtrr.txt を参照すること。
/proc/net
さまざまなネットワークについての擬似ファイルで、それぞれがネット
ワ ーク層の各種の状態を与える。これらのファイルの内容は ASCII 形
式なので、 cat(1) で読み出せる。とはいえ基本コ マ ン ド の net-
stat(8) はこれらのファイルの内容のよりすっきりとした表示を提供す
る。
/proc/net/arp
アドレス解決に使われるカーネルの ARP テーブルの ASCII 可読なダン
プを保持している。動的結合されたものと固定 (pre-programmed) の両
方の APP エントリを見ることができる。フォーマットは以下のとおり:
IP address HW type Flags HW address Mask Device
192.168.0.50 0x1 0x2 00:50:BF:25:68:F3 * eth0
192.168.0.250 0x1 0xc 00:00:00:00:00:00 * eth0
こ こで IP address はマシンの IPv4 アドレス、 HW type はそのアド
レスの RFC 826 で定められているハードウェアの形式、 Flags は ARP
構造体 (/usr/include/linux/if_arp.h 内で定義されている) の内部フ
ラグ、 HW address はその IP アドレスにマップされているデータリン
ク層のアドレス (もしわかっていれば) である。
/proc/net/dev
擬 似ファイル dev はネットワークデバイスの状態情報を含んでいる。
これは送受信したパケット数、エラーとコリジョン (collision) の 回
数 、その他の基本的な統計を与える。これらは ifconfig(8) がデバイ
スの状態を報告するのに使われる。フォーマットは以下のとおり:
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
lo: 2776770 11307 0 0 0 0 0 0 2776770 11307 0 0 0 0 0 0
eth0: 1215645 2751 0 0 0 0 0 0 1782404 4324 0 0 0 427 0 0
ppp0: 1622270 5552 1 0 0 0 0 0 354130 5669 0 0 0 0 0 0
tap0: 7714 81 0 0 0 0 0 0 7714 81 0 0 0 0 0 0
/proc/net/dev_mcast
/usr/src/linux/net/core/dev_mcast.c で定義されており、以下の形式
である。
indx interface_name dmi_u dmi_g dmi_address
2 eth0 1 0 01005e000001
3 eth1 1 0 01005e000001
4 eth2 1 0 01005e000001
/proc/net/igmp
Internet Group Management Protocol (インターネットグループ管理プ
ロトコル)。 /usr/src/linux/net/core/igmp.c で定義されている。
/proc/net/rarp
このファイルは arp と同じフォーマットで逆アドレス解決サ ー ビ ス
(reverse address lookup services) rarp(8) に提供するために使われ
る現在の逆マップデータベースの内容を含んでいる。 RARP がカーネル
コンフィグレーションに設定されていなければ、このファイルは存在し
ない。
/proc/net/raw
RAW ソケットテーブルのダンプを保持している。ほとんどの情報はデバ
ッグ以外では使われない。 "sl" の値はソケットのカーネルハッシュス
ロット、 "local_address" はローカルアドレスとプロトコル番号の ペ
ア [訳者追加: "rem_address" はリモートアドレスとプロトコル番号の
ペア]。 "st" はソケットの内部状態。 "tx_queue" と "rx_queue" は
カーネルメモリを消費している送信/受信データキューのサイズ。 "tr"
と "tm->when" と "rexmits" フィールドは RAW では使われていない。
"uid" フィールドはソケット生成者の実効 UID を保持している。
/proc/net/snmp
こ のファイルは SNMP エージェントが必要とする IP, ICMP, TCP, UDP
管理情報を ASCII データとして保持している。
/proc/net/tcp
TCP ソケットテーブルのダンプを保持している。大部分の情報はデバッ
グ以外には使われない。 sl はソケットのカーネルハッシュスロットの
値、 "local_address" はローカルアドレスとポート番号のペアであ る
。 (ソケットが接続している場合は) "rem_address" はリモートアドレ
スとポート番号の対である。 "st" はソケットの内部状態 で あ る 。
"tx_queue" と "rx_queue" はカーネルメモリを消費している送信/受信
データキューのサイズ。 "tr" と "tm->when" と "rexmits" フィー ル
ドはソケット状態のカーネル内部情報を保持しているが、これらはデバ
ッグのときにしか役に立たない。 "uid" フィールドはソケット生成 者
の実効 UID を保持している。
/proc/net/udp
UDP ソケットテーブルのダンプを保持している。大部分の情報はデバッ
グ以外には使われない。 sl はソケットのカーネルハッシュスロットの
値 、 "local_address" はローカルアドレスとポート番号のペアである
。 (ソケットが接続している場合は) "rem_address" はリモートアドレ
ス と ポート番号のペアである。 "st" はソケットの内部状態である。
"tx_queue" と "rx_queue" はカーネルメモリを消費している送信/受信
デ ータキューのサイズ。 "tr" と "tm->when" と "rexmits" フィール
ドは UDP では使われていない。 "uid" フィールドはソケット生成者の
実効 UID を保持している。フォーマットは以下のとおり:
sl local_address rem_address st tx_queue rx_queue tr rexmits tm->when uid
1: 01642C89:0201 0C642C89:03FF 01 00000000:00000001 01:000071BA 00000000 0
1: 00000000:0801 00000000:0000 0A 00000000:00000000 00:00000000 6F000100 0
1: 00000000:0201 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0
/proc/net/unix
Unix ドメインソケットのリスト。フォーマットは以下のとおり:
Num RefCount Protocol Flags Type St Path
0: 00000002 00000000 00000000 0001 03
1: 00000001 00000000 00010000 0001 01 /dev/printer
ここで、Num はカーネルのテーブルスロット数、 RefCount はソケット
を使用しているユーザー数、 Protocol はいまのところいつも 0 で
、Flags はソケットの状態を保持しているカーネル内部のフラグである
。 Type はいまのところいつも 1 (UNIX ドメインのデータグラムソ ケ
ッ トは、現在のカーネルではサポートされていない [訳注: 2.0.34 で
はサポートされているようだ])。 St はソケットの内部状態 で 、Path
は (もしあれば) ソケットのパス名である。
/proc/partitions
各パーティションのメジャー番号とマイナー番号が書かれている。さら
に、ブロック数とパーティション名も書かれている。
/proc/pci
カーネルの初期化時に見つかったすべての PCI デバイスのリストと そ
の設定。
このファイルは非推奨であり、新しい PCI 用の /proc インターフェイ
ス (/proc/bus/pci) を使うこと。このファイルは Linux 2.2 でオプシ
ョ ンになった (カーネルのコンパイル時に CONFIG_PCI_OLD_PROC をセ
ットすると利用可能であった)。 Linux 2.4 で再びオプションなしで有
効 に 戻 っ た 。 さ ら に 、Linux 2.6 で 非 推奨となり (CON-
FIG_PCI_LEGACY_PROC をセットするとまだ利用可能であった)、最終 的
に Linux 2.6.17 以降で完全に削除された。
/proc/scsi
scsi 中間レベル擬似ファイルといくつかの SCSI 低レベルドライバの
ディレクトリを含むディレクトリ。これらのファイルは ASCII で表 現
されているので cat(1) で読める。
いくつかのファイルは書き込み可能で、サブシステムの設定を変更した
り、特定の機能をオン/オフすることができる。
/proc/scsi/scsi
カーネルが知っているすべての SCSI デバイスのリスト。このリストは
起動時に (コンソールで) 見られるものとほぼ同じである。 scsi は現
在のところ add-single-device コマンドのみをサポートしている。 こ
れ に よ り ルート (root) は既知のデバイスリストへ活線挿抜 (hot-
plugged) デバイスを加えることができる。
次のコマンドを実行すると、
echo 'scsi add-single-device 1 0 5 0' > /proc/scsi/scsi
ホストアダプタ scsi1 は SCSI チャネル 0 で ID 5 LUN 0 のデバイス
を探す。もしこのアドレスに既知のデバイスがあるか、不正なアドレス
であったならばエラーが返る。
/proc/scsi/[drivername]
いまのとこ ろ [drivername] は NCR53c7xx, aha152x, aha1542,
aha1740, aic7xxx, buslogic, eata_dma, eata_pio, fdomain, in2000,
pas16, qlogic, scsi_debug, seagate, t128, u15-24f, ultrastore,
wd7000 のどれかである。少なくとも 1 つの SCSI ホストバスアダプタ
(HBA) にドライバが割り当てられていると、そのドライバに対応したデ
ィレクトリが現れる。それぞれのディレクトリには、登録されたホスト
アダプタに対応してファイルが作られる。このファイルの名前は、シス
テムの初期化の際にホストアダプタに割り当てられた番号になる。
これらのファイルを読めばドライバとホストアダプタの設定や統計など
を見ることができる。
これらのファイルへの書き込みはホストアダプタごとに異なる動作を引
き起こす。たとえば latency と nolatency コマンドを用いると、ルー
ト (root、スーパーユーザー) は eata_dma ドライバの隠し測定コード
のオン/オフを切り替えることができる。また lockup と unlock コマ
ンドを用いると、ルートは scsi_debug ドライバがシミュレートするバ
スロックアップ (bus lockup) を制御することができる。
/proc/self
このディレクトリはプロセスに (プロセス自身の) /proc ファイルシス
テムへのアクセスを参照させる。これは /proc 内の (このプロセスの)
プロセス ID が名前となっているディレクトリと全く同一である。
/proc/slabinfo
Linux 2.6.16 以降では、カーネル設定オプション CONFIG_SLAB が有効
の場合にのみ、このファイルは存在する。カーネルキャッシュの情報。
/proc/slabinfo のフィールドは以下のとおり。
cache-name
num-active-objs
total-objs
object-size
num-active-slabs
total-slabs
num-pages-per-slab
詳細は slabinfo(5) を参照すること。
/proc/stat
カ ーネル/システムの統計。アーキテクチャによって異なる。共通エン
トリには以下のものが含まれる。
cpu 3357 0 4313 1362393
ユーザーモード、低い優先度 (nice) でのユーザーモード、 シ
ス テムモード、タスク待ち (idle task)、でそれぞれシステム
が消費した時間を USER_HZ を単位として計測した積算値。 (ほ
と んどのアーキテクチャでは USER_HZ は 1/100 秒である。正
しい値は sysconf(_SC_CLK_TCK) を使って取得できる。) 最 後
の 値 (タスク待ち) は疑似ファイル uptime の 2番目のエント
リの値を USER_HZ 倍したものである。
Linux 2.6 では、この行に 3つの欄が追加されている: iowait
(I/O の完了を待っていた時間; 2.5.41 以降); irq (割り込み
処理を行った時間; 2.6.0-test4 以降); softirq (ソフト割 り
込みの処理を行った時間; 2.6.0-test4 以降)。
Linux 2.6.11 以降では、8 個目の欄として steal (盗まれた時
間; stolen time) が存在する。これは、仮想化環境での動作時
に 他のオペレーティングシステムにより消費された時間である
。
Linux 2.6.24 以降では、9 個目の欄として、 guest がある 。
これは、 Linux カーネルの制御下のゲストオペレーティングシ
ステムの仮想 CPU の実行に消費された時間である。
page 5741 1808
システムが (ディスクから) ページイン/ページアウトしたペー
ジ数。
swap 1 0
スワップイン/スワップアウトされたページ数。
intr 1462898
こ の行はシステム起動時以降に処理された割り込みの回数を示
す。最初の欄は処理された割り込み全ての合計であり、それ 以
降の欄は個々の割り込みについての合計数である。
disk_io: (2,0):(31,30,5764,1,2) (3,0):...
( メ ジ ャ ー 番 号, ディスクインデックス番号):(情報なし
(noinfo), 読み込み回数, 読み込みブロック数, 書き出し回数,
書き出しブロック数)
(Linux 2.4 のみ)
ctxt 115315
コンテクスト・スイッチの延べ回数。
btime 769041601
起動時刻、紀元年 (epoch, 1970 年 1 月 1 日午前 0 時) から
の秒数。
processes 86031
システム起動時からの延べフォーク (fork) 数。
procs_running 6
実行中状態のプロセス数 (Linux 2.5.45 以降)。
procs_blocked 2
I/O 完了待ちで停止 (blocked) しているプロセ ス 数 (Linux
2.5.45 以降)。
/proc/swaps
使用中のスワップ領域。 swapon(8) も参照すること。
/proc/sys
こ のディレクトリ (1.3.57 以降に存在) はカーネル変数に対応するい
くつかのファイルとサブディレクトリを含む。これらの変数は読み出し
可 能である。また場合によっては /proc ファイルシステムや、 (非推
奨の) システムコール sysctl(2) を用いて書き換えることもできる 。
いまのところ abi, debug, dev, fs, kernel, net, proc, rxrpc, sun-
rpc, vm というサブディレクトリがあって、それぞれがファイルとサブ
ディレクトリを含んでいる。
/proc/sys/abi (Linux 2.4.10 以降)
このディレクトリにはアプリケーションのバイナリ情報が入ったファイ
ルが置かれる。更に詳しい情報は、カーネルソースファイル Documen-
tation/sysctl/abi.txt を参照すること。
/proc/sys/debug
このディレクトリは空の場合もある。
/proc/sys/dev
このディレクトリにはデバイス特有の情報 (たとえば dev/cdrom/info)
が含まれる。このディレクトリが空になっているシステムもある。
/proc/sys/fs
このディレクトリには、サブディレクトリ binfmt_misc, epoll, ino-
tify, mqueue と以下のファイルがある: dentry-state, dir-notify-
enable, dquot-nr, file-max, file-nr, inode-max, inode-nr, inode-
state, lease-break-time, leases-enable, overflowgid, over-
flowuid, suid_dumpable, super-max, super-nr.
/proc/sys/fs/binfmt_misc
このディレクトリ以下のファイルについてのドキュメントは、カーネル
ソースの Documentation/binfmt_misc.txt にある。
/proc/sys/fs/dentry-state (Linux 2.2 以降)
このファイルには、ディレクトリキャッシュ (dcache) の状態に関する
情報が入っている。ファイルには、 nr_dentry, nr_unused, age_limit
( 秒 単位の age), want_pages (システムがリクエストしたページ数),
ダミーの 2 つの値、という 6 つの数字が書かれている。
* nr_dentry は割り当てられた dentry (dcache エントリ) の数である
。このフィールドは Linux 2.2 では使用されない。
* nr_unused は未使用の dentry 数である。
* age_limit は、メモリが不足している場合に次に dcache entry を再
要求できるようになるまでの残り時間 (秒数) である。
* want_pages は、カーネルが shrink_dcache_pages() を呼び出したが
dcache がまだ縮小されていない場合に、0 以外の値となる。
/proc/sys/fs/dir-notify-enable
こ のファイルは fcntl(2) に記述されている dnotify インターフェー
スをシステム全体で無効にしたり有効にしたりする。このファイルに値
0 が書かれている場合はインターフェースが無効になり、値 1 の場合
は有効になる。
/proc/sys/fs/dquot-max
このファイルにはキャッシュされるディスク quota エントリの最大 数
が書かれている。 (2.4 系の) システムの中には、このファイルが存在
しないものもある。キャッシュされるディスク quota エントリの空 き
が非常に少なく、とても多くのシステムユーザーが同時に存在する場合
、この制限を上げるといいかもしれない。
/proc/sys/fs/dquot-nr
このファイルには割り当てられているディスク quota のエントリ数 と
、空いているディスク quota のエントリ数が書かれている。
/proc/sys/fs/epoll (Linux 2.6.28 以降)
このディレクトリには、ファイル max_user_watches がある。これらは
、 epoll インタフェースが消費するカーネルメモリ量を制限するの に
使用できる。詳細は epoll(7) を参照。
/proc/sys/fs/file-max
このファイルはシステム全体でプロセスがオープンできるファイル数の
上限を定義する。 (各プロセスがオープンできるファイル数の上 限 を
RLIMIT_NOFILE によって設定する setrlimit(2) も参照すること。) フ
ァイルハンドルを使い果たして大量にエラーメッセージが出る場合は、
以下のようにしてこの値を増加させてみよ:
echo 100000 > /proc/sys/fs/file-max
file-max に書かれている値は、カーネル定数 NR_OPEN に制限される。
/proc/sys/fs/file-max を増やした場合は、 /proc/sys/fs/inode-max
を新しい /proc/sys/fs/file-max の値の 3-4 倍に増やしておくこと。
こうしないと inode を使い果たしてしまうだろう。
/proc/sys/fs/file-nr
(このファイルは読み出し専用で) 読み出すと現在オープンされてい る
ファイルの数が得られる。このファイルには、割り当てられているファ
イルハンドル数・空いているファイルハンドル数・ファイルハンドル数
の 最大値、という 3 つの数値が書かれている。カーネルはファイルハ
ンドルを動的に割り当てるが、それを再び解放しない。割り当てられて
いるファイル数が最大値に近づいた場合は、最大値を大きくすることを
考慮すべきである。空いているファイルハンドル数が多い場合は、ファ
イルハンドルの使用のピークを経験したことがあり、最大値を大きくす
る必要はないだろう。
/proc/sys/fs/inode-max
このファイルには、メモリ内 inode の最大値が書かれている 。 (2.4
系の) システムによっては、このファイルが存在しないかもしれない。
この値は file-max の値の 3-4 倍にすべきである。 こ れ は stdin,
stdout, ネットワークソケットを扱うにも inode が必要なためである
。日常的に inode を使い果たしている場合は、この値を増やす必要 が
ある。
/proc/sys/fs/inode-nr
このファイルには、 inode-state の最初の 2 つの値が書かれている。
/proc/sys/fs/inode-state
このファイルには 7 個 の 値 が 書 か れ て い る: nr_inodes,
nr_free_inodes, preshrink と 4 つのダミーの値である。 nr_inodes
はシステムが確保する inode の数である。 Linux は 1 度に 1 ページ
分 いっぱいに nr_inode を確保するので、この値が inode-max より幾
分大きくなることもある。 nr_free_inodes は空いている inode の 数
を 表す。 nr_inodes > inode-max の場合、 preshrink は 0 以外の値
になる。この場合システムは inode をさらに確保するのでは な く 、
inode リストを切り詰める必要がある。
/proc/sys/fs/inotify (Linux 2.6.13 以降)
こ の デ ィ レ ク ト リ に は 、 フ ァ イ ル max_queued_events,
max_user_instances, and max_user_watches がある。これらは、 ino-
tify インタフェースが消費するカーネルメモリ量を制限するのに利用
できる。詳細は inotify(7) を参照。
/proc/sys/fs/lease-break-time
このファイルは、ファイルを保持しているプロセスに対してカーネルが
シグナルを送り、他のプロセスがそのファイルをオープンするのを待っ
ていることを通知してから、そのプロセスに対してカーネルがファイル
の リース (lease, 貸し出し) (fcntl(2) を参照) を許す猶予期間を指
定する。リースホルダ (lease holder: ファイルの貸し出しを受けてい
るプロセス) が猶予期間中にリースを削除するか階級を低くしない場合
、カーネルはファイルのリースを強制的に止める。
/proc/sys/fs/leases-enable
このファイルはシステム全体でのファイルリース (fcntl(2) を 参 照)
を 有効または無効にする。ファイルに値 0 が書き込まれている場合、
リースは無効である。 0 以外の場合にはリースは有効である。
/proc/sys/fs/mqueue (Linux 2.6.6 以降)
このディレクト リ に は フ ァ イ ル msg_max, msgsize_max, and
queues_max がある。これらは POSIX メッセージキューで使用されるリ
ソースの制御を行う。詳細は mq_overview(7) を参照。
/proc/sys/fs/overflowgid と /proc/sys/fs/overflowuid
これらのファイルにより、ユーザーは固定 UID と固定 GID の値を変更
できる。デフォルトは 65534 である。 Linux の UID と GID は 32 ビ
ットであるが、 16 ビットの UID と GID しかサポートしないファイル
システムもある。このようなファイルシステムが書き込みを許可してマ
ウントされた場合、 65535 を超える UID と GID は、ディスクに書 き
込まれる前にオーバーフロー値に変換される。
/proc/sys/fs/suid_dumpable (Linux 2.6.13 以降)
このファイルの値により、set-user-ID されたバイナリや、保護がかか
った (protected) バイナリ / tainted な (汚染された; ライセンスが
カーネルと適合しない) バイナリに対して、コアダンプファイルを生成
するかどうかが決定される。以下の 3つの値を指定することができる:
0 (default) この値を指定すると、以前と同じ (Linux 2.6.13 より 前
の) 動 作 をする。 (seteuid(2), setgid(2) などを呼び出すことや
、set-user-ID や set-group-ID されたプログラムを実行すること で)
資 格情報 (credentials) が変更されているプロセスや、プロセスの実
行バイナリの読み出し許可がないプロセスに対して、コアダンプを生成
しない。
1 ("debug") すべてのプロセスで、可能であればコアダンプを行う。コ
アダンプファイルの所有者は、ダンプを行うプロセスのファイルシステ
ム UID となり、セキュリティ上の考慮は行われない。この値は、シス
テムデバッグの場面だけを想定して設けられている。 ptrace のチェッ
クも行われない。
2 ("suidsafe") 通常はダンプされないようなバイナリ (上記の "0" 参
照) を root だけが読み出し可能な形でダンプする。この場合、ユーザ
はそのコアダンプファイルを削除することはできるが、読むことはでき
ない。セキュリティ上の理由から、このモードのコアダンプでは、既存
のダンプファイルや他のファイルを上書きすることはない。このモード
は、管理者が通常の環境で問題を解析しようとする際に適している。
このファイルはスーパブロックの値を制御する。
この値はカーネルがマウントできるファイルシステムの最大値になる。
現 在、 super-max で許可されているファイルシステム数以上にマウン
トする必要がある場合は、この値を増加させるだけでよい。
/proc/sys/fs/super-nr
このファイルには現在マウントされているファイルシステム数が書かれ
ている。
/proc/sys/kernel
このディレクトリには、以下で説明する様々なカーネルパラメータを制
御するためのファイルが配置されている。
/proc/sys/kernel/acct
このファイルには 3 つの値が含まれてい る: highwater, lowwater,
frequency である。 BSD-style process accounting が有効になってい
る場合、これら 3 つの値が動作を制御する。ログファイルのあるフ ァ
イルシステムの空き領域が lowwater パーセント以下になった場合は、
ログ記録を一時停止する。空き領域が highwater パーセント以上に な
っ た場合に、ログ記録を再開する。 frequency はカーネルが空き領域
のチェックをする頻度である (単位は秒)。デフォルトの値は 、4, 2,
30 である。つまり、空き領域が 2% 以下になるとログ記録を一時停止
し、空き領域が 4% 以上となったときに再開する。空き領域についての
情報は 30 秒間有効である点に注意すること。
/proc/sys/kernel/cap-bound (Linux 2.2 to 2.6.24 以降)
/proc/sys/kernel/cap-bound このファイルにはカーネルの capability
bounding set (符号付き 10 進数表現) の値 が 書 か れ て い る 。
execve(2) 中は、このセットとプロセスに許可されている権限の AND
がとられる。 Linux 2.6.25 以降では、システム全体のケーパビリティ
バウンディングセットはなくなり、スレッド単位のバウンディングセッ
トに置き換えられた。 capabilities(7) を参照。
/proc/sys/kernel/core_pattern
core(5) 参照。
/proc/sys/kernel/core_uses_pid
core(5) 参照。
/proc/sys/kernel/ctrl-alt-del
このファイルはキーボードの Ctrl-Alt-Del の扱いを制御する。このフ
ァ イルにある値が 0 の場合、 Ctrl-Alt-Del が捕捉されると init(8)
プログラムに送られて、正しく再起動される。値が 0 より大きい場 合
、Vulcan Nerve Pinch (tm) に反応して、 Linux はダーティバッファ
を同期させることなく、すぐに再起動を行う。注意: プ ロ グ ラ ム
(dosemu など) に "raw" モードのキーボードがある場合、 ctrl-alt-
del はカーネルの tty レイヤーに到達する前にプログラムに遮断さ れ
、プログラムに送られてどのように扱うかが決められる。
/proc/sys/kernel/hotplug
このファイルはホットプラグ・ポリシー・エージェントのパスが書かれ
ている。このファイルのデフォルト値は /sbin/hotplug である。
/proc/sys/kernel/domainname と /proc/sys/kernel/hostname
これらのファイルは、コマンド domainname(1), hostname(1) と全く同
じ方法で、マシンの NIS/YP ドメイン名とホスト名の設定に使える。す
なわち
# echo 'darkstar' > /proc/sys/kernel/hostname
# echo 'mydomain' > /proc/sys/kernel/domainname
は、以下と同じ効果がある。
# hostname 'darkstar'
# domainname 'mydomain'
注意: 典型的な darkstar.frop.org という名前には、ホスト名 "dark-
star" と DNS (Internet Domain Name Server) ドメイン名 "frop.org"
が含まれているが、DNS ドメイン名と NIS (Network Information Ser-
vice) または YP (Yellow Pages) のドメイン名を混同してはならない
。一般にこれら 2 つのドメイン名は異なる。詳細な議論 は 、 host-
name(1) の man ページを参照すること。
/proc/sys/kernel/htab-reclaim
(PowerPC のみ) このファイルを 0 以外の値に設定すると、 PowerPC
htab (カーネルソースファイル Documentation/powerpc/ppc_htab.txt
参照) を、システムがアイドルループになるたびに切り詰める。
/proc/sys/kernel/l2cr
(PowerPC のみ) このファイルには G3 プロセッサボードの L2 キャッ
シュを制御するフラグが含まれる。 0 の場合、キャッシュは無効に な
る。 0 以外の場合は有効になる。
/proc/sys/kernel/modprobe
このファイルには、カーネルモジュールローダへのパスが含まれる。デ
フォルトの値は /sbin/modprobe である。このファ イ ル は 、 CON-
FIG_KMOD オプションを有効にしてカーネルが作成されている場合にの
み存在する。このファイルについては、カーネルソースファイル Docu-
mentation/kmod.txt (カーネル 2.4 以前のみに存在) に記述されてい
る。
/proc/sys/kernel/msgmax
このファイルは、System V メッセージキューに書き込まれる 1 つのメ
ッセージの最大バイト数を、システム全体で制限する。
/proc/sys/kernel/msgmni
このファイルはメッセージキュー識別子の最大数をシステム全体で制限
する。 (このファイルは Linux 2.4 以降にしか存在しない)。
/proc/sys/kernel/msgmnb
このファイルは、 msg_qbytes の設定を初期化するシステム全体のパラ
メータである。 msg_qbytes は以降で作成されるメッセージキューで使
われる。 msg_qbytes 設定では、メッセージキューに書き込まれる最大
バイト数を指定する。
/proc/sys/kernel/ostype と /proc/sys/kernel/osrelease
これらのファイルは文字列 /proc/version の各部分を与える。
/proc/sys/kernel/overflowgid と /proc/sys/kernel/overflowuid
こ れ ら の フ ァ イ ル は /proc/sys/fs/overflowgid と
/proc/sys/fs/overflowuid を複製したものである。
/proc/sys/kernel/panic
このファイルはカーネル変数 panic_timeout への読み出しと書き込 み
の アクセスを与える。この値が 0 ならば、パニック時にカーネルは (
無限) ループに入る。 0 でなければ、その秒数だけ待ってから自動 的
に再起動する。ソフトウェア watchdog ドライバを使っている場合、推
奨される設定は 60 である。
/proc/sys/kernel/panic_on_oops (Linux 2.5.68 以降)
このファイルは、oops や BUG が起こった場合のカーネルの動作を制御
す る。ファイルに 0 が書かれている場合、システムは操作を続行しよ
うとする。 1 が書かれている場合、システムは (klogd が oops 出 力
を 記録する時間を与えるために) 数秒間遅延した後、 panic を起こす
。 /proc/sys/kernel/panic ファイルも 0 でない場合、マシンは再 起
動される。
/proc/sys/kernel/pid_max (Linux 2.5.34 以降)
このファイルは、PID をいくつで終了にするかを指定する (すなわち、
このファイルの値は最大 PID より 1 大きい)。このファイルのデフ ォ
ルト値は 32768 であり、その場合には以前のカーネルと同じ PID の範
囲になる。 32ビットのプラットフォームでは、 pid_max の最大 値 は
32768 で あ る 。 64 ビ ッ ト の プ ラットフォームでは、 2^22
(PID_MAX_LIMIT, 約 4,000,000) までの任意の値を設定できる。
/proc/sys/kernel/powersave-nap (PowerPC のみ)
このファイルにはフラグが書かれている。フラグが 設 定 さ れ る と
、Linux-PPC は 省電力の "nap" モードを使う。設定されない場合は
、"doze" モードが使われる。
/proc/sys/kernel/printk
このファイルにある 4 つの値は、 console_loglevel, default_mes-
sage_loglevel, minimum_console_loglevel, default_con-
sole_loglevel である。これらの値はエラーメッセージを表示したり記
録したりする printk() の動作に影響する。各 loglevel の情報につい
ては、 syslog(2) を参照すること。優先度が console_loglevel 以 上
のメッセージは、コンソールに表示される。優先度が明示されていない
メッセージは、優先度が default_message_level のときに表示され る
。 minimum_console_loglevel は console_loglevel に設定できる最小
(最高) の値である。 default_console_loglevel は console_loglevel
のデフォルトの値である。
/proc/sys/kernel/pty (Linux 2.6.4 以降)
こ のディレクトリは、Unix 98 疑似端末 (pts(4) を参照) の数に関連
する 2 つのファイルを含む。
/proc/sys/kernel/pty/max
このファイルは疑似端末の最大数を定義する。
/proc/sys/kernel/pty/nr
この読み出し専用のファイルは、現在いくつの疑似端末が使われている
かを表す。
/proc/sys/kernel/random
こ のディレクトリは、ファイル /dev/random の操作を制御する様々な
パラメータが書かれている。詳細は random(4) を参照。
/proc/sys/kernel/real-root-dev
このファイルはカーネルソースファイル Documentation/initrd.txt に
記述されている。
/proc/sys/kernel/reboot-cmd (Sparc のみ)
こ のファイルは SPARC ROM/Flash ブートローダに引き数を渡す方法を
提供しているように思われる。再起動後に何をするかを指定しているの
だろうか?
/proc/sys/kernel/rtsig-max
(2.6.7 までのカーネルにのみ存在する。 setrlimit(2) を参照するこ
と) このファイルはシステムで発行される POSIX real-time (queued)
signal の最大数を調整するのに使用される。
/proc/sys/kernel/rtsig-nr
(2.6.7 までのカーネルにのみ存在する) このファイルは現在キューに
入っている POSIX real-time signal の数を表す。
/proc/sys/kernel/sem (Linux 2.4 以降)
このファイルには System V IPC セマフォを制限する 4 つの値が書 か
れている。これらのフィールドは次の順番に並んでいる:
SEMMSL セマフォ集合ごとのセマフォ数の最大値。
SEMMNS システム全体での、全てのセマフォ集合におけるセマフォ数の
制限。
SEMOPM semop(2) コールに指定されるオペレーション数の最大値。
SEMMNI システム全体でのセマフォ識別子の最大値。
/proc/sys/kernel/sg-big-buff
このファイルは、汎用 SCSI デバイス (sg) のバッファサイズの最大値
を 表 す 。 今 は これを変更することはできないが、コンパイル時に
include/scsi/sg.h を編集して SG_BIG_BUFF の値を変えれば変更で き
る。ただし、この値を変更する理由はないだろう。
/proc/sys/kernel/shmall
このファイルには System V 共有メモリの総ページ数のシステム全体で
の制限が書かれている。
/proc/sys/kernel/shmmax
このファイルを通じて、(System V IPC) 共有メモリセグメントを作 成
するときの最大サイズの実行時上限 (run-time limit) を取得または設
定できる。現在は 1GB までの共有メモリセグメントがカーネルでサ ポ
ートされている。この値のデフォルトは SHMMAX である。
/proc/sys/kernel/shmmni
(Linux 2.4 以降で使用可能) このファイルは、システム全体で作成可
能な System V 共有メモリセグメント数を指定する。
/proc/sys/kernel/sysrq
このファイルは、SysRq キーにより起動が許可されている関数群を制御
す るものである。デフォルトでは、ファイルの内容は 1 であり、これ
は起こり得る全ての SysRq リクエストが許可されることを意味する (
古いバージョンのカーネルでは、SysRq はデフォルトでは無効になって
おり、実行時に明示的に有効にする必要があったが、今はそうで は な
い)。このファイルで指定可能な値は以下の通り。
0 - sysrq を完全に無効にする
1 - sysrq の全ての関数を有効にする
>1 - 許可する sysrq 関数のビットマスク。内訳は以下の通り。
2 - コンソールのログ・レベルの制御を有効にする
4 - キーボードの制御を有効にする (SAK, unraw)
8 - プロセスなどのデバッグ・ダンプを有効にする
16 - sync コマンドを有効にする
32 - 読み出し専用での再マウントを有効にする
64 - プロセスへのシグナル発行を有効にする (term, kill,
oom-kill)
128 - リブート/電源オフを許可する
256 - 全てのリアルタイム・タスクの nice 値の変更を許可す
る
カーネル設定オプション CONFIG_MAGIG_SYSRQ が有効な場合のみ、この
ファイルは存在する。詳細は、カーネルソースファ イ ル Documenta-
tion/sysrq.txt を参照のこと。
/proc/sys/kernel/version
このファイルには、以下のような文字列が書かれている:
#5 Wed Feb 25 21:49:24 MET 1998
"#5" はこのソースで構築された 5 番目のカーネルであることを意味す
る。その後にある日付はカーネルが構築された時刻を表す。
/proc/sys/kernel/threads-max (Linux 2.3.11 以降)
このファイルは、システム全体で作成可能なスレッド数 (タスク数) の
上限を指定する。
/proc/sys/kernel/zero-paged (PowerPC のみ)
こ の フ ァ イ ル はフラグを含む。 (0 以外の値で) 有効された場合
、Linux-PPC はアイドルループ で pre-zero page を 行 う の で
、get_free_pages の速度が向上する可能性がある。
/proc/sys/net
このディレクトリにはネットワーク関係の情報が入っている。このディ
レクトリにあるファイルのいくつかについては、 tcp(7) や ip(7) に
説明がある。
/proc/sys/net/core/somaxconn
このファイルは listen(2) の backlog 引き数の上限値を規定する。詳
細は listen(2) のマニュアルページを参照。
/proc/sys/proc
このディレクトリはたぶん空である。
/proc/sys/sunrpc
このディレクトリはネットワークファイルシステム (NFS) へ の Sun
remote procedure call (遠隔手続き呼び出し) をサポートする。これ
が存在しないシステムもある。
/proc/sys/vm
このディレクトリにはメモリ管理の調整、バッファやキャッシュ管理の
ためのファイルがある。
/proc/sys/vm/drop_caches (Linux 2.6.16 以降)
このファイルに書き込みを行うことで、クリーンなキャッシュ、dentry
、 inode をメモリ上から外し、そのメモリを解放する。
ペ ー ジ キ ャ ッ シ ュ を 解 放 す る に は 、 echo 1 >
/proc/sys/vm/drop_caches とする。 dentry、inode を解放するには、
echo 2 > /proc/sys/vm/drop_caches とする。ペー ジ キ ャ ッ シ ュ
、dentry 、inode を 解 放 す る に は 、 echo 3 >
/proc/sys/vm/drop_caches とする。
この操作は非破壊的な操作で、ダーティな (dirty) オブジェクトは 解
放 されないので、この操作を行う際は最初に sync(8) を実行しておく
べきである。
/proc/sys/vm/swappiness
このファイルの値により、カーネルがどの程度激しくメモリページのス
ワップを行うかが制御される。大きな値ほどスワップが激しくなり、小
さい値ほど激しくなくなる。デフォルト値は 60 である。
/proc/sys/vm/legacy_va_layout (Linux 2.6.9 以降)
0 以外の場合、新しい 32ビットメモリマッピング配置が無効になり 、
カ ーネルは全てのプロセスに対して従来の (カーネル 2.4 の) 配置方
法を使用する。
/proc/sys/vm/oom_dump_tasks (Linux 2.6.25 以降)
カーネルが OOM-killing を実行する際に、システム全体のタスク・ ダ
ンプ (カーネルスレッドを除く) を生成するかを制御する。ダンプには
、タスク (スレッド、プロセス) 毎に以下の情報が出力される: スレッ
ド ID、実ユーザ ID、スレッドグループ ID (プロセス ID)、仮想メモ
リサイズ、Resident Set Size (実メモリ上に存在するページサイズ)、
タ ス ク が ス ケ ジ ュ ー リ ン グ さ れた CPU、 oom_adj スコア
(/proc/[pid]/oom_adj の説明を参照)、コマンド名。このダンプ情報は
、なぜ OOM-killer が起動されたかを知り、その原因となったならず者
のタスクを特定するのに役に立つ。
このファイルの内容が値 0 の場合、ダンプ情報の出力は行われない 。
タスクが何千もある非常に巨大なシステムでは、各々のタスクについて
メモリ状態をダンプするのは適切でないかもしれない。そのようなシス
テ ムでは、ダンプ情報が必要でもないときにメモリ不足 (OOM) の状況
で性能面の不利益が起こらないようにすべきだろう。
このファイルの内容が 0 以外の場合、 OOM-killer が実際にメモリ を
占有したタスクを kill する度にダンプ情報が出力される。
デフォルト値は 0 である。
/proc/sys/vm/oom_kill_allocating_task (Linux 2.6.24 以降)
こ のファイルは、メモリ不足 (OOM) の状況が起こった際に、メモリ不
足のきっかけとなったタスクを kill するかどうかを制御する。
このファイルが 0 に設定された場合、 OOM-killer はタスクリスト 全
体をスキャンし、経験則に基づき kill するタスクを選択する。通常は
、kill した場合に多くのメモリが解放できる、ならず者のメモリ占 有
タスクが選択される。
こ のファイルが 0 以外に設定された場合、 OOM-killer はメモリ不足
の状況が発生するきっかけとなったタスクを単純に kill するだけであ
る。これにより、たいていは重い処理となるタスクリストのスキャンを
回避できる。
/proc/sys/vm/panic_on_oom が 0 以 外 の 場 合 、
/proc/sys/vm/oom_kill_allocating_task にどのような値が入っていた
としても、 /proc/sys/vm/panic_on_oom の方が優先される。
デフォルト値は 0 である。
/proc/sys/vm/overcommit_memory
このファイルにはカーネル仮想メモリのアカウントモードが書かれてい
る。値は以下の通り:
0: 発見的なオーバーコミット (heuristic overcommit) (これ
がデフォルトである)
1: 常にオーバーコミットし、チェックしない。
2: 常にチェックし、オーバーコミットしない。
モード 0 では、 MAP_NORESERVE を設定して呼び出された mmap(2) は
チェックされない。またデフォルトのチェックはとても脆弱で、プロセ
スを "OOM-kill" してしまうリスクを引き起こす。 Linux 2.4 では 0
以 外の値はモード 1 を意味する。 (Linux 2.6 以降で利用可能な) モ
ード 2 では、システム上の仮想アドレ ス 空 間 の 合 計 が (SS +
RAM*(r/100)) に制限されている。ここで、SS はスワップ空間のサイズ
、 RAM は物理メモリのサイズ、r はファイル /proc/sys/vm/overcom-
mit_ratio の内容である。
/proc/sys/vm/overcommit_ratio
/proc/sys/vm/overcommit_memory の説明を参照すること。
/proc/sys/vm/panic_on_oom (Linux 2.6.18 以降)
このファイルは、メモリ不足時にカーネルパニックを起こすか起こさな
いかを制御する。
このファイルに値 0 を設定すると、カーネルの OOM-killer がなら ず
者 のプロセスを kill する。普通は、OOM-killer がならず者のプロセ
スを kill することができ、システムは何とか動き続けることができる
。
こ のファイルに値 1 を設定すると、メモリ不足の状況が発生すると、
カーネルは普通はパニックする。しかしながら、プロセスがメモリポリ
シー (mbind(2) の MPOL_BIND) や cpusets (cpuset(7)) を使って特定
のノードへのメモリ割り当てを制限していて、それらのノードでメモリ
枯 渇状態に至った場合は、一つのプロセスが OOM-killer により kill
されるだけかもしれない。この場合には、カーネルパニックは発生しな
い。なぜなら、他のノードのメモリには空きがあるかもしれず、したが
って、システム全体としてはメモリ不足の状況にまだ達していないかも
しれないからである。
こ のファイルに値 2 を設定すると、メモリ不足の状況が発生するとカ
ーネルは常にパニックを起こす。
デフォルト値は 0 である。 1 と 2 はクラスタリングのフェイルオ ー
バー用である。フェイルオーバーの方針に応じてどちらかの値を選択す
ること。
/proc/sysrq-trigger (Linux 2.4.21 以降)
このファイルに文字 character を書き込むと、キーボードか ら ALT-
SysRq- を 入力した場合と同じ SysRq 関数が起動される
(/proc/sys/kernel/sysrq の説明を参照)。通常、このファイルへ書 き
込みができるのは root だけである。詳細については、カーネルソース
ファイルの Documentation/sysrq.txt を参照のこと。
/proc/sysvipc
疑似ファイル msg, sem, shm を含むサブディレクトリ。これらのフ ァ
イルは、現在システム上に存在する System V プロセス間通信 (Inter-
process Communication, IPC) オブジェクト (それぞれ: メッセージキ
ュ ー、セマフォ、共有メモリ) のリストであり、 ipcs(1) で取得でき
る情報と同じものを提供する。これらのファイルにはヘッダがあり、理
解しやすいように (1 行につき 1 個の IPC オブジェクトの形式で) フ
ォーマットされている。 svipc(7) にはこれらのファイルから分かる情
報の詳細な背景が書かれている。
/proc/tty
疑 似 フ ァイルを含むサブディレクトリ。 tty ドライバとライン設定
(line discipline) の書かれたサブディレクトリも含まれる。
/proc/uptime
このファイルはシステム起動時から経過した時間 (秒) と ア イ ド ル
(idle) しているプロセスが消費した時間 (秒) の 2 つの数を含む。
/proc/version
現在稼働しているカーネルのバージョン識別子である文字列。これには
/proc/sys/ostype, /proc/sys/osrelease, /proc/sys/version の内 容
が含まれる。たとえばこのように:
Linux version 1.0.9 (quinlan@phaze) #1 Sat May 14 01:51:54 EDT 1994
/proc/vmstat (Linux 2.6 以降)
このファイルは仮想メモリの様々な統計情報を表示する。
/proc/zoneinfo (Linux 2.6.13 以降)
こ のファイルはメモリのゾーン (memory zone) に関する情報を表示す
る。仮想メモリの振舞いを分析するのに役立つ。
注意
ほとんどの文字列 (たとえば環境変数やコマンド行) は内部表現のままなの で
、 各フィールドは NULL バイト ('\0') で区切られている。だから、od -c や
tr "\000" "\n" を使えば、それらはより読みやすくなる。 ま た echo `cat
` でもよい。
こ のマニュアルは不完全であり、たぶん不正確で、しばしば更新される必要が
ある。
関連項目
cat(1), find(1), free(1), ps(1), tr(1), uptime(1), chroot(2), mmap(2),
readlink(2), syslog(2), slabinfo(5), hier(7), time(7), arp(8),
dmesg(8), hdparm(8), ifconfig(8), init(8), lsmod(8), lspci(8),
mount(8), netstat(8), procinfo(8), route(8)
カ ーネルのソースファイル: Documentation/filesystems/proc.txt, Documen-
tation/sysctl/vm.txt
Linux 2009-03-30 PROC(5)
PROC(5) Linux Programmer’s Manual PROC(5)
NAME
proc - process information pseudo-file system
DESCRIPTION
The proc file system is a pseudo-file system which is used as an inter-
face to kernel data structures. It is commonly mounted at /proc. Most
of it is read-only, but some files allow kernel variables to be
changed.
The following outline gives a quick tour through the /proc hierarchy.
/proc/[pid]
There is a numerical subdirectory for each running process; the
subdirectory is named by the process ID. Each such subdirectory
contains the following pseudo-files and directories.
/proc/[pid]/auxv (since 2.6.0-test7)
This contains the contents of the ELF interpreter information
passed to the process at exec time. The format is one unsigned
long ID plus one unsigned long value for each entry. The last
entry contains two zeros.
/proc/[pid]/cmdline
This holds the complete command line for the process, unless the
process is a zombie. In the latter case, there is nothing in
this file: that is, a read on this file will return 0 charac-
ters. The command-line arguments appear in this file as a set
of null-separated strings, with a further null byte ('\0') after
the last string.
/proc/[pid]/coredump_filter (since kernel 2.6.23)
See core(5).
/proc/[pid]/cpuset (since kernel 2.6.12)
See cpuset(7).
/proc/[pid]/cwd
This is a symbolic link to the current working directory of the
process. To find out the current working directory of process
20, for instance, you can do this:
$ cd /proc/20/cwd; /bin/pwd
Note that the pwd command is often a shell built-in, and might
not work properly. In bash(1), you may use pwd -P.
In a multithreaded process, the contents of this symbolic link
are not available if the main thread has already terminated
(typically by calling pthread_exit(3)).
/proc/[pid]/environ
This file contains the environment for the process. The entries
are separated by null bytes ('\0'), and there may be a null byte
at the end. Thus, to print out the environment of process 1,
you would do:
$ (cat /proc/1/environ; echo) | tr '\000' '\n'
/proc/[pid]/exe
Under Linux 2.2 and later, this file is a symbolic link contain-
ing the actual pathname of the executed command. This symbolic
link can be dereferenced normally; attempting to open it will
open the executable. You can even type /proc/[pid]/exe to run
another copy of the same executable as is being run by process
[pid]. In a multithreaded process, the contents of this sym-
bolic link are not available if the main thread has already ter-
minated (typically by calling pthread_exit(3)).
Under Linux 2.0 and earlier /proc/[pid]/exe is a pointer to the
binary which was executed, and appears as a symbolic link. A
readlink(2) call on this file under Linux 2.0 returns a string
in the format:
[device]:inode
For example, [0301]:1502 would be inode 1502 on device major 03
(IDE, MFM, etc. drives) minor 01 (first partition on the first
drive).
find(1) with the -inum option can be used to locate the file.
/proc/[pid]/fd
This is a subdirectory containing one entry for each file which
the process has open, named by its file descriptor, and which is
a symbolic link to the actual file. Thus, 0 is standard input,
1 standard output, 2 standard error, etc.
In a multithreaded process, the contents of this directory are
not available if the main thread has already terminated (typi-
cally by calling pthread_exit(3)).
Programs that will take a filename as a command-line argument,
but will not take input from standard input if no argument is
supplied, or that write to a file named as a command-line argu-
ment, but will not send their output to standard output if no
argument is supplied, can nevertheless be made to use standard
input or standard out using /proc/[pid]/fd. For example, assum-
ing that -i is the flag designating an input file and -o is the
flag designating an output file:
$ foobar -i /proc/self/fd/0 -o /proc/self/fd/1 ...
and you have a working filter.
/proc/self/fd/N is approximately the same as /dev/fd/N in some
Unix and Unix-like systems. Most Linux MAKEDEV scripts symboli-
cally link /dev/fd to /proc/self/fd, in fact.
Most systems provide symbolic links /dev/stdin, /dev/stdout, and
/dev/stderr, which respectively link to the files 0, 1, and 2 in
/proc/self/fd. Thus the example command above could be written
as:
$ foobar -i /dev/stdin -o /dev/stdout ...
/proc/[pid]/fdinfo/ (since kernel 2.6.22)
This is a subdirectory containing one entry for each file which
the process has open, named by its file descriptor. The con-
tents of each file can be read to obtain information about the
corresponding file descriptor, for example:
$ cat /proc/12015/fdinfo/4
pos: 1000
flags: 01002002
The pos field is a decimal number showing the current file off-
set. The flags field is an octal number that displays the file
access mode and file status flags (see open(2)).
The files in this directory are readable only by the owner of
the process.
/proc/[pid]/limits (since kernel 2.6.24)
This file displays the soft limit, hard limit, and units of mea-
surement for each of the process’s resource limits (see getr-
limit(2)). The file is protected to only allow reading by the
real UID of the process.
/proc/[pid]/maps
A file containing the currently mapped memory regions and their
access permissions.
The format is:
address perms offset dev inode pathname
08048000-08056000 r-xp 00000000 03:0c 64593 /usr/sbin/gpm
08056000-08058000 rw-p 0000d000 03:0c 64593 /usr/sbin/gpm
08058000-0805b000 rwxp 00000000 00:00 0
40000000-40013000 r-xp 00000000 03:0c 4165 /lib/ld-2.2.4.so
40013000-40015000 rw-p 00012000 03:0c 4165 /lib/ld-2.2.4.so
4001f000-40135000 r-xp 00000000 03:0c 45494 /lib/libc-2.2.4.so
40135000-4013e000 rw-p 00115000 03:0c 45494 /lib/libc-2.2.4.so
4013e000-40142000 rw-p 00000000 00:00 0
bffff000-c0000000 rwxp 00000000 00:00 0
where "address" is the address space in the process that it
occupies, "perms" is a set of permissions:
r = read
w = write
x = execute
s = shared
p = private (copy on write)
"offset" is the offset into the file/whatever, "dev" is the
device (major:minor), and "inode" is the inode on that device.
0 indicates that no inode is associated with the memory region,
as the case would be with BSS (uninitialized data).
Under Linux 2.0 there is no field giving pathname.
/proc/[pid]/mem
This file can be used to access the pages of a process’s memory
through open(2), read(2), and lseek(2).
/proc/[pid]/mountinfo (since Linux 2.6.26)
This file contains information about mount points. It contains
lines of the form:
36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue
(1)(2)(3) (4) (5) (6) (7) (8) (9) (10) (11)
The numbers in parentheses are labels for the descriptions
below:
(1) mount ID: unique identifier of the mount (may be reused
after umount(2)).
(2) parent ID: ID of parent mount (or of self for the top of
the mount tree).
(3) major:minor: value of st_dev for files on file system (see
stat(2)).
(4) root: root of the mount within the file system.
(5) mount point: mount point relative to the process’s root.
(6) mount options: per-mount options.
(7) optional fields: zero or more fields of the form
"tag[:value]".
(8) separator: marks the end of the optional fields.
(9) file system type: name of file system in the form
"type[.subtype]".
(10) mount source: file system-specific information or "none".
(11) super options: per-super block options.
Parsers should ignore all unrecognized optional fields. Cur-
rently the possible optional fields are:
shared:X mount is shared in peer group X
master:X mount is slave to peer group X
propagate_from:X mount is slave and receives propagation
from peer group X (*)
unbindable mount is unbindable
(*) X is the closest dominant peer group under the process’s
root. If X is the immediate master of the mount, or if there is
no dominant peer group under the same root, then only the "mas-
ter:X" field is present and not the "propagate_from:X" field.
For more information on mount propagation see: Documenta-
tion/filesystems/sharedsubtree.txt in the kernel source tree.
/proc/[pid]/mounts (since Linux 2.4.19)
This is a list of all the file systems currently mounted in the
process’s mount namespace. The format of this file is docu-
mented in fstab(5). Since kernel version 2.6.15, this file is
pollable: after opening the file for reading, a change in this
file (i.e., a file system mount or unmount) causes select(2) to
mark the file descriptor as readable, and poll(2) and
epoll_wait(2) mark the file as having an error condition.
/proc/[pid]/mountstats (since Linux 2.6.17)
This file exports information (statistics, configuration infor-
mation) about the mount points in the process’s name space.
Lines in this file have the form:
device /dev/sda7 mounted on /home with fstype ext3 [statistics]
( 1 ) ( 2 ) (3 ) (4)
The fields in each line are:
(1) The name of the mounted device (or "nodevice" if there is
no corresponding device).
(2) The mount point within the file system tree.
(3) The file system type.
(4) Optional statistics and configuration information. Cur-
rently (as at Linux 2.6.26), only NFS file systems export
information via this field.
This file is only readable by the owner of the process.
/proc/[pid]/numa_maps (since Linux 2.6.14)
See numa(7).
/proc/[pid]/oom_adj (since Linux 2.6.11)
This file can be used to adjust the score used to select which
process should be killed in an out-of-memory (OOM) situation.
The kernel uses this value for a bit-shift operation of the pro-
cess’s oom_score value: valid values are in the range -16 to
+15, plus the special value -17, which disables OOM-killing
altogether for this process. A positive score increases the
likelihood of this process being killed by the OOM-killer; a
negative score decreases the likelihood.
The default value for this file is 0; a new process inherits its
parent’s oom_adj setting. A process must be privileged
(CAP_SYS_RESOURCE) to update this file.
Since Linux 2.6.36, use of this file is deprecated in favor of
/proc/[pid]/oom_score_adj.
/proc/[pid]/oom_score (since Linux 2.6.11)
This file displays the current score that the kernel gives to
this process for the purpose of selecting a process for the OOM-
killer. A higher score means that the process is more likely to
be selected by the OOM-killer. The basis for this score is the
amount of memory used by the process, with increases (+) or
decreases (-) for factors including:
* whether the process creates a lot of children using fork(2)
(+);
* whether the process has been running a long time, or has used
a lot of CPU time (-);
* whether the process has a low nice value (i.e., > 0) (+);
* whether the process is privileged (-); and
* whether the process is making direct hardware access (-).
The oom_score also reflects the adjustment specified by the
oom_score_adj or oom_adj setting for the process.
/proc/[pid]/oom_score_adj
This file can be used to adjust the badness heuristic used to
select which process gets killed in out-of-memory conditions.
The badness heuristic assigns a value to each candidate task
ranging from 0 (never kill) to 1000 (always kill) to determine
which process is targeted. The units are roughly a proportion
along that range of allowed memory the process may allocate
from, based on an estimation of its current memory and swap use.
For example, if a task is using all allowed memory, its badness
score will be 1000. If it is using half of its allowed memory,
its score will be 500.
There is an additional factor included in the badness score:
root processes are given 3% extra memory over other tasks.
The amount of "allowed" memory depends on the context in which
the OOM-killer was called. If it is due to the memory assigned
to the allocating task’s cpuset being exhausted, the allowed
memory represents the set of mems assigned to that cpuset (see
cpuset(7)). If it is due to a mempolicy’s node(s) being
exhausted, the allowed memory represents the set of mempolicy
nodes. If it is due to a memory limit (or swap limit) being
reached, the allowed memory is that configured limit. Finally,
if it is due to the entire system being out of memory, the
allowed memory represents all allocatable resources.
The value of oom_score_adj is added to the badness score before
it is used to determine which task to kill. Acceptable values
range from -1000 (OOM_SCORE_ADJ_MIN) to +1000
(OOM_SCORE_ADJ_MAX). This allows user space to control the
preference for OOM-killing, ranging from always preferring a
certain task or completely disabling it from OOM-killing. The
lowest possible value, -1000, is equivalent to disabling OOM-
killing entirely for that task, since it will always report a
badness score of 0.
Consequently, it is very simple for user space to define the
amount of memory to consider for each task. Setting a
oom_score_adj value of +500, for example, is roughly equivalent
to allowing the remainder of tasks sharing the same system,
cpuset, mempolicy, or memory controller resources to use at
least 50% more memory. A value of -500, on the other hand,
would be roughly equivalent to discounting 50% of the task’s
allowed memory from being considered as scoring against the
task.
For backward compatibility with previous kernels,
/proc/[pid]/oom_adj can still be used to tune the badness score.
Its value is scaled linearly with oom_score_adj.
Writing to /proc/[pid]/oom_score_adj or /proc/[pid]/oom_adj will
change the other with its scaled value.
/proc/[pid]/root
Unix and Linux support the idea of a per-process root of the
file system, set by the chroot(2) system call. This file is a
symbolic link that points to the process’s root directory, and
behaves as exe, fd/*, etc. do.
In a multithreaded process, the contents of this symbolic link
are not available if the main thread has already terminated
(typically by calling pthread_exit(3)).
/proc/[pid]/smaps (since Linux 2.6.14)
This file shows memory consumption for each of the process’s
mappings. For each of mappings there is a series of lines such
as the following:
08048000-080bc000 r-xp 00000000 03:02 13130 /bin/bash
Size: 464 kB
Rss: 424 kB
Shared_Clean: 424 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 0 kB
The first of these lines shows the same information as is dis-
played for the mapping in /proc/[pid]/maps. The remaining lines
show the size of the mapping, the amount of the mapping that is
currently resident in RAM, the number of clean and dirty shared
pages in the mapping, and the number of clean and dirty private
pages in the mapping.
This file is only present if the CONFIG_MMU kernel configuration
option is enabled.
/proc/[pid]/stat
Status information about the process. This is used by ps(1).
It is defined in /usr/src/linux/fs/proc/array.c.
The fields, in order, with their proper scanf(3) format speci-
fiers, are:
pid %d The process ID.
comm %s The filename of the executable, in parentheses.
This is visible whether or not the executable is
swapped out.
state %c One character from the string "RSDZTW" where R is
running, S is sleeping in an interruptible wait, D
is waiting in uninterruptible disk sleep, Z is zom-
bie, T is traced or stopped (on a signal), and W is
paging.
ppid %d The PID of the parent.
pgrp %d The process group ID of the process.
session %d The session ID of the process.
tty_nr %d The controlling terminal of the process. (The minor
device number is contained in the combination of
bits 31 to 20 and 7 to 0; the major device number is
in bits 15 t0 8.)
tpgid %d The ID of the foreground process group of the con-
trolling terminal of the process.
flags %u (%lu before Linux 2.6.22)
The kernel flags word of the process. For bit mean-
ings, see the PF_* defines in .
Details depend on the kernel version.
minflt %lu The number of minor faults the process has made
which have not required loading a memory page from
disk.
cminflt %lu The number of minor faults that the process’s
waited-for children have made.
majflt %lu The number of major faults the process has made
which have required loading a memory page from disk.
cmajflt %lu The number of major faults that the process’s
waited-for children have made.
utime %lu Amount of time that this process has been scheduled
in user mode, measured in clock ticks (divide by
sysconf(_SC_CLK_TCK). This includes guest time,
guest_time (time spent running a virtual CPU, see
below), so that applications that are not aware of
the guest time field do not lose that time from
their calculations.
stime %lu Amount of time that this process has been scheduled
in kernel mode, measured in clock ticks (divide by
sysconf(_SC_CLK_TCK).
cutime %ld Amount of time that this process’s waited-for chil-
dren have been scheduled in user mode, measured in
clock ticks (divide by sysconf(_SC_CLK_TCK). (See
also times(2).) This includes guest time,
cguest_time (time spent running a virtual CPU, see
below).
cstime %ld Amount of time that this process’s waited-for chil-
dren have been scheduled in kernel mode, measured in
clock ticks (divide by sysconf(_SC_CLK_TCK).
priority %ld
(Explanation for Linux 2.6) For processes running a
real-time scheduling policy (policy below; see
sched_setscheduler(2)), this is the negated schedul-
ing priority, minus one; that is, a number in the
range -2 to -100, corresponding to real-time priori-
ties 1 to 99. For processes running under a non-
real-time scheduling policy, this is the raw nice
value (setpriority(2)) as represented in the kernel.
The kernel stores nice values as numbers in the
range 0 (high) to 39 (low), corresponding to the
user-visible nice range of -20 to 19.
Before Linux 2.6, this was a scaled value based on
the scheduler weighting given to this process.
nice %ld The nice value (see setpriority(2)), a value in the
range 19 (low priority) to -20 (high priority).
num_threads %ld
Number of threads in this process (since Linux 2.6).
Before kernel 2.6, this field was hard coded to 0 as
a placeholder for an earlier removed field.
itrealvalue %ld
The time in jiffies before the next SIGALRM is sent
to the process due to an interval timer. Since ker-
nel 2.6.17, this field is no longer maintained, and
is hard coded as 0.
starttime %llu (was %lu before Linux 2.6)
The time in jiffies the process started after system
boot.
vsize %lu Virtual memory size in bytes.
rss %ld Resident Set Size: number of pages the process has
in real memory. This is just the pages which count
towards text, data, or stack space. This does not
include pages which have not been demand-loaded in,
or which are swapped out.
rsslim %lu Current soft limit in bytes on the rss of the pro-
cess; see the description of RLIMIT_RSS in getprior-
ity(2).
startcode %lu
The address above which program text can run.
endcode %lu The address below which program text can run.
startstack %lu
The address of the start (i.e., bottom) of the
stack.
kstkesp %lu The current value of ESP (stack pointer), as found
in the kernel stack page for the process.
kstkeip %lu The current EIP (instruction pointer).
signal %lu The bitmap of pending signals, displayed as a deci-
mal number. Obsolete, because it does not provide
information on real-time signals; use
/proc/[pid]/status instead.
blocked %lu The bitmap of blocked signals, displayed as a deci-
mal number. Obsolete, because it does not provide
information on real-time signals; use
/proc/[pid]/status instead.
sigignore %lu
The bitmap of ignored signals, displayed as a deci-
mal number. Obsolete, because it does not provide
information on real-time signals; use
/proc/[pid]/status instead.
sigcatch %lu
The bitmap of caught signals, displayed as a decimal
number. Obsolete, because it does not provide
information on real-time signals; use
/proc/[pid]/status instead.
wchan %lu This is the "channel" in which the process is wait-
ing. It is the address of a system call, and can be
looked up in a namelist if you need a textual name.
(If you have an up-to-date /etc/psdatabase, then try
ps -l to see the WCHAN field in action.)
nswap %lu Number of pages swapped (not maintained).
cnswap %lu Cumulative nswap for child processes (not main-
tained).
exit_signal %d (since Linux 2.1.22)
Signal to be sent to parent when we die.
processor %d (since Linux 2.2.8)
CPU number last executed on.
rt_priority %u (since Linux 2.5.19; was %lu before Linux 2.6.22)
Real-time scheduling priority, a number in the range
1 to 99 for processes scheduled under a real-time
policy, or 0, for non-real-time processes (see
sched_setscheduler(2)).
policy %u (since Linux 2.5.19; was %lu before Linux 2.6.22)
Scheduling policy (see sched_setscheduler(2)).
Decode using the SCHED_* constants in linux/sched.h.
delayacct_blkio_ticks %llu (since Linux 2.6.18)
Aggregated block I/O delays, measured in clock ticks
(centiseconds).
guest_time %lu (since Linux 2.6.24)
Guest time of the process (time spent running a vir-
tual CPU for a guest operating system), measured in
clock ticks (divide by sysconf(_SC_CLK_TCK).
cguest_time %ld (since Linux 2.6.24)
Guest time of the process’s children, measured in
clock ticks (divide by sysconf(_SC_CLK_TCK).
/proc/[pid]/statm
Provides information about memory usage, measured in pages. The
columns are:
size total program size
(same as VmSize in /proc/[pid]/status)
resident resident set size
(same as VmRSS in /proc/[pid]/status)
share shared pages (from shared mappings)
text text (code)
lib library (unused in Linux 2.6)
data data + stack
dt dirty pages (unused in Linux 2.6)
/proc/[pid]/status
Provides much of the information in /proc/[pid]/stat and
/proc/[pid]/statm in a format that’s easier for humans to parse.
Here’s an example:
$ cat /proc/$$/status
Name: bash
State: S (sleeping)
Tgid: 3515
Pid: 3515
PPid: 3452
TracerPid: 0
Uid: 1000 1000 1000 1000
Gid: 100 100 100 100
FDSize: 256
Groups: 16 33 100
VmPeak: 9136 kB
VmSize: 7896 kB
VmLck: 0 kB
VmHWM: 7572 kB
VmRSS: 6316 kB
VmData: 5224 kB
VmStk: 88 kB
VmExe: 572 kB
VmLib: 1708 kB
VmPTE: 20 kB
Threads: 1
SigQ: 0/3067
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000010000
SigIgn: 0000000000384004
SigCgt: 000000004b813efb
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: ffffffffffffffff
Cpus_allowed: 00000001
Cpus_allowed_list: 0
Mems_allowed: 1
Mems_allowed_list: 0
voluntary_ctxt_switches: 150
nonvoluntary_ctxt_switches: 545
The fields are as follows:
* Name: Command run by this process.
* State: Current state of the process. One of "R (running)", "S
(sleeping)", "D (disk sleep)", "T (stopped)", "T (tracing
stop)", "Z (zombie)", or "X (dead)".
* Tgid: Thread group ID (i.e., Process ID).
* Pid: Thread ID (see gettid(2)).
* TracerPid: PID of process tracing this process (0 if not being
traced).
* Uid, Gid: Real, effective, saved set, and file system UIDs
(GIDs).
* FDSize: Number of file descriptor slots currently allocated.
* Groups: Supplementary group list.
* VmPeak: Peak virtual memory size.
* VmSize: Virtual memory size.
* VmLck: Locked memory size.
* VmHWM: Peak resident set size ("high water mark").
* VmRSS: Resident set size.
* VmData, VmStk, VmExe: Size of data, stack, and text segments.
* VmLib: Shared library code size.
* VmPTE: Page table entries size (since Linux 2.6.10).
* Threads: Number of threads in process containing this thread.
* SigPnd, ShdPnd: Number of signals pending for thread and for
process as a whole (see pthreads(7) and signal(7)).
* SigBlk, SigIgn, SigCgt: Masks indicating signals being
blocked, ignored, and caught (see signal(7)).
* CapInh, CapPrm, CapEff: Masks of capabilities enabled in
inheritable, permitted, and effective sets (see capabili-
ties(7)).
* CapBnd: Capability Bounding set (since kernel 2.6.26, see
capabilities(7)).
* Cpus_allowed: Mask of CPUs on which this process may run
(since Linux 2.6.24, see cpuset(7)).
* Cpus_allowed_list: Same as previous, but in "list format"
(since Linux 2.6.26, see cpuset(7)).
* Mems_allowed: Mask of memory nodes allowed to this process
(since Linux 2.6.24, see cpuset(7)).
* Mems_allowed_list: Same as previous, but in "list format"
(since Linux 2.6.26, see cpuset(7)).
* voluntary_context_switches, nonvoluntary_context_switches:
Number of voluntary and involuntary context switches (since
Linux 2.6.23).
/proc/[pid]/task (since Linux 2.6.0-test6)
This is a directory that contains one subdirectory for each
thread in the process. The name of each subdirectory is the
numerical thread ID ([tid]) of the thread (see gettid(2)).
Within each of these subdirectories, there is a set of files
with the same names and contents as under the /proc/[pid] direc-
tories. For attributes that are shared by all threads, the con-
tents for each of the files under the task/[tid] subdirectories
will be the same as in the corresponding file in the parent
/proc/[pid] directory (e.g., in a multithreaded process, all of
the task/[tid]/cwd files will have the same value as the
/proc/[pid]/cwd file in the parent directory, since all of the
threads in a process share a working directory). For attributes
that are distinct for each thread, the corresponding files under
task/[tid] may have different values (e.g., various fields in
each of the task/[tid]/status files may be different for each
thread).
In a multithreaded process, the contents of the /proc/[pid]/task
directory are not available if the main thread has already ter-
minated (typically by calling pthread_exit(3)).
/proc/apm
Advanced power management version and battery information when
CONFIG_APM is defined at kernel compilation time.
/proc/bus
Contains subdirectories for installed busses.
/proc/bus/pccard
Subdirectory for PCMCIA devices when CONFIG_PCMCIA is set at
kernel compilation time.
/proc/bus/pccard/drivers
/proc/bus/pci
Contains various bus subdirectories and pseudo-files containing
information about PCI busses, installed devices, and device
drivers. Some of these files are not ASCII.
/proc/bus/pci/devices
Information about PCI devices. They may be accessed through
lspci(8) and setpci(8).
/proc/cmdline
Arguments passed to the Linux kernel at boot time. Often done
via a boot manager such as lilo(8) or grub(8).
/proc/config.gz (since Linux 2.6)
This file exposes the configuration options that were used to
build the currently running kernel, in the same format as they
would be shown in the .config file that resulted when configur-
ing the kernel (using make xconfig, make config, or similar).
The file contents are compressed; view or search them using
zcat(1), zgrep(1), etc. As long as no changes have been made to
the following file, the contents of /proc/config.gz are the same
as those provided by :
cat /lib/modules/$(uname -r)/build/.config
/proc/config.gz is only provided if the kernel is configured
with CONFIG_IKCONFIG_PROC.
/proc/cpuinfo
This is a collection of CPU and system architecture dependent
items, for each supported architecture a different list. Two
common entries are processor which gives CPU number and
bogomips; a system constant that is calculated during kernel
initialization. SMP machines have information for each CPU.
/proc/devices
Text listing of major numbers and device groups. This can be
used by MAKEDEV scripts for consistency with the kernel.
/proc/diskstats (since Linux 2.5.69)
This file contains disk I/O statistics for each disk device.
See the kernel source file Documentation/iostats.txt for further
information.
/proc/dma
This is a list of the registered ISA DMA (direct memory access)
channels in use.
/proc/driver
Empty subdirectory.
/proc/execdomains
List of the execution domains (ABI personalities).
/proc/fb
Frame buffer information when CONFIG_FB is defined during kernel
compilation.
/proc/filesystems
A text listing of the file systems which are supported by the
kernel, namely file systems which were compiled into the kernel
or whose kernel modules are currently loaded. (See also
filesystems(5).) If a file system is marked with "nodev", this
means that it does not require a block device to be mounted
(e.g., virtual file system, network file system).
Incidentally, this file may be used by mount(8) when no file
system is specified and it didn’t manage to determine the file
system type. Then file systems contained in this file are tried
(excepted those that are marked with "nodev").
/proc/fs
Contains subdirectories that in turn contain files with informa-
tion about (certain) mounted filesystems.
/proc/ide
This directory exists on systems with the IDE bus. There are
directories for each IDE channel and attached device. Files
include:
cache buffer size in KB
capacity number of sectors
driver driver version
geometry physical and logical geometry
identify in hexadecimal
media media type
model manufacturer’s model number
settings drive settings
smart_thresholds in hexadecimal
smart_values in hexadecimal
The hdparm(8) utility provides access to this information in a
friendly format.
/proc/interrupts
This is used to record the number of interrupts per CPU per IO
device. Since Linux 2.6.24, for the i386 and x86_64 architec-
tures, at least, this also includes interrupts internal to the
system (that is, not associated with a device as such), such as
NMI (nonmaskable interrupt), LOC (local timer interrupt), and
for SMP systems, TLB (TLB flush interrupt), RES (rescheduling
interrupt), CAL (remote function call interrupt), and possibly
others. Very easy to read formatting, done in ASCII.
/proc/iomem
I/O memory map in Linux 2.4.
/proc/ioports
This is a list of currently registered Input-Output port regions
that are in use.
/proc/kallsyms (since Linux 2.5.71)
This holds the kernel exported symbol definitions used by the
modules(X) tools to dynamically link and bind loadable modules.
In Linux 2.5.47 and earlier, a similar file with slightly dif-
ferent syntax was named ksyms.
/proc/kcore
This file represents the physical memory of the system and is
stored in the ELF core file format. With this pseudo-file, and
an unstripped kernel (/usr/src/linux/vmlinux) binary, GDB can be
used to examine the current state of any kernel data structures.
The total length of the file is the size of physical memory
(RAM) plus 4KB.
/proc/kmsg
This file can be used instead of the syslog(2) system call to
read kernel messages. A process must have superuser privileges
to read this file, and only one process should read this file.
This file should not be read if a syslog process is running
which uses the syslog(2) system call facility to log kernel mes-
sages.
Information in this file is retrieved with the dmesg(8) program.
/proc/ksyms (Linux 1.1.23-2.5.47)
See /proc/kallsyms.
/proc/loadavg
The first three fields in this file are load average figures
giving the number of jobs in the run queue (state R) or waiting
for disk I/O (state D) averaged over 1, 5, and 15 minutes. They
are the same as the load average numbers given by uptime(1) and
other programs. The fourth field consists of two numbers sepa-
rated by a slash (/). The first of these is the number of cur-
rently executing kernel scheduling entities (processes,
threads); this will be less than or equal to the number of CPUs.
The value after the slash is the number of kernel scheduling
entities that currently exist on the system. The fifth field is
the PID of the process that was most recently created on the
system.
/proc/locks
This file shows current file locks (flock(2) and fcntl(2)) and
leases (fcntl(2)).
/proc/malloc (only up to and including Linux 2.2)
This file is only present if CONFIG_DEBUG_MALLOC was defined
during compilation.
/proc/meminfo
This file reports statistics about memory usage on the system.
It is used by free(1) to report the amount of free and used mem-
ory (both physical and swap) on the system as well as the shared
memory and buffers used by the kernel.
/proc/modules
A text list of the modules that have been loaded by the system.
See also lsmod(8).
/proc/mounts
Before kernel 2.4.19, this file was a list of all the file sys-
tems currently mounted on the system. With the introduction of
per-process mount namespaces in Linux 2.4.19, this file became a
link to /proc/self/mounts, which lists the mount points of the
process’s own mount namespace. The format of this file is docu-
mented in fstab(5).
/proc/mtrr
Memory Type Range Registers. See the kernel source file Docu-
mentation/mtrr.txt for details.
/proc/net
various net pseudo-files, all of which give the status of some
part of the networking layer. These files contain ASCII struc-
tures and are, therefore, readable with cat(1). However, the
standard netstat(8) suite provides much cleaner access to these
files.
/proc/net/arp
This holds an ASCII readable dump of the kernel ARP table used
for address resolutions. It will show both dynamically learned
and pre-programmed ARP entries. The format is:
IP address HW type Flags HW address Mask Device
192.168.0.50 0x1 0x2 00:50:BF:25:68:F3 * eth0
192.168.0.250 0x1 0xc 00:00:00:00:00:00 * eth0
Here "IP address" is the IPv4 address of the machine and the "HW
type" is the hardware type of the address from RFC 826. The
flags are the internal flags of the ARP structure (as defined in
/usr/include/linux/if_arp.h) and the "HW address" is the data
link layer mapping for that IP address if it is known.
/proc/net/dev
The dev pseudo-file contains network device status information.
This gives the number of received and sent packets, the number
of errors and collisions and other basic statistics. These are
used by the ifconfig(8) program to report device status. The
format is:
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
lo: 2776770 11307 0 0 0 0 0 0 2776770 11307 0 0 0 0 0 0
eth0: 1215645 2751 0 0 0 0 0 0 1782404 4324 0 0 0 427 0 0
ppp0: 1622270 5552 1 0 0 0 0 0 354130 5669 0 0 0 0 0 0
tap0: 7714 81 0 0 0 0 0 0 7714 81 0 0 0 0 0 0
/proc/net/dev_mcast
Defined in /usr/src/linux/net/core/dev_mcast.c:
indx interface_name dmi_u dmi_g dmi_address
2 eth0 1 0 01005e000001
3 eth1 1 0 01005e000001
4 eth2 1 0 01005e000001
/proc/net/igmp
Internet Group Management Protocol. Defined in
/usr/src/linux/net/core/igmp.c.
/proc/net/rarp
This file uses the same format as the arp file and contains the
current reverse mapping database used to provide rarp(8) reverse
address lookup services. If RARP is not configured into the
kernel, this file will not be present.
/proc/net/raw
Holds a dump of the RAW socket table. Much of the information
is not of use apart from debugging. The "sl" value is the ker-
nel hash slot for the socket, the "local_address" is the local
address and protocol number pair. "St" is the internal status
of the socket. The "tx_queue" and "rx_queue" are the outgoing
and incoming data queue in terms of kernel memory usage. The
"tr", "tm->when", and "rexmits" fields are not used by RAW. The
"uid" field holds the effective UID of the creator of the
socket.
/proc/net/snmp
This file holds the ASCII data needed for the IP, ICMP, TCP, and
UDP management information bases for an SNMP agent.
/proc/net/tcp
Holds a dump of the TCP socket table. Much of the information
is not of use apart from debugging. The "sl" value is the ker-
nel hash slot for the socket, the "local_address" is the local
address and port number pair. The "rem_address" is the remote
address and port number pair (if connected). "St" is the inter-
nal status of the socket. The "tx_queue" and "rx_queue" are the
outgoing and incoming data queue in terms of kernel memory
usage. The "tr", "tm->when", and "rexmits" fields hold internal
information of the kernel socket state and are only useful for
debugging. The "uid" field holds the effective UID of the cre-
ator of the socket.
/proc/net/udp
Holds a dump of the UDP socket table. Much of the information
is not of use apart from debugging. The "sl" value is the ker-
nel hash slot for the socket, the "local_address" is the local
address and port number pair. The "rem_address" is the remote
address and port number pair (if connected). "St" is the inter-
nal status of the socket. The "tx_queue" and "rx_queue" are the
outgoing and incoming data queue in terms of kernel memory
usage. The "tr", "tm->when", and "rexmits" fields are not used
by UDP. The "uid" field holds the effective UID of the creator
of the socket. The format is:
sl local_address rem_address st tx_queue rx_queue tr rexmits tm->when uid
1: 01642C89:0201 0C642C89:03FF 01 00000000:00000001 01:000071BA 00000000 0
1: 00000000:0801 00000000:0000 0A 00000000:00000000 00:00000000 6F000100 0
1: 00000000:0201 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0
/proc/net/unix
Lists the Unix domain sockets present within the system and
their status. The format is:
Num RefCount Protocol Flags Type St Path
0: 00000002 00000000 00000000 0001 03
1: 00000001 00000000 00010000 0001 01 /dev/printer
Here "Num" is the kernel table slot number, "RefCount" is the
number of users of the socket, "Protocol" is currently always 0,
"Flags" represent the internal kernel flags holding the status
of the socket. Currently, type is always "1" (Unix domain data-
gram sockets are not yet supported in the kernel). "St" is the
internal state of the socket and Path is the bound path (if any)
of the socket.
/proc/partitions
Contains major and minor numbers of each partition as well as
number of blocks and partition name.
/proc/pci
This is a listing of all PCI devices found during kernel ini-
tialization and their configuration.
This file has been deprecated in favor of a new /proc interface
for PCI (/proc/bus/pci). It became optional in Linux 2.2
(available with CONFIG_PCI_OLD_PROC set at kernel compilation).
It became once more non-optionally enabled in Linux 2.4. Next,
it was deprecated in Linux 2.6 (still available with CON-
FIG_PCI_LEGACY_PROC set), and finally removed altogether since
Linux 2.6.17.
/proc/scsi
A directory with the scsi mid-level pseudo-file and various SCSI
low-level driver directories, which contain a file for each SCSI
host in this system, all of which give the status of some part
of the SCSI IO subsystem. These files contain ASCII structures
and are, therefore, readable with cat(1).
You can also write to some of the files to reconfigure the sub-
system or switch certain features on or off.
/proc/scsi/scsi
This is a listing of all SCSI devices known to the kernel. The
listing is similar to the one seen during bootup. scsi cur-
rently supports only the add-single-device command which allows
root to add a hotplugged device to the list of known devices.
The command
echo 'scsi add-single-device 1 0 5 0' > /proc/scsi/scsi
will cause host scsi1 to scan on SCSI channel 0 for a device on
ID 5 LUN 0. If there is already a device known on this address
or the address is invalid, an error will be returned.
/proc/scsi/[drivername]
[drivername] can currently be NCR53c7xx, aha152x, aha1542,
aha1740, aic7xxx, buslogic, eata_dma, eata_pio, fdomain, in2000,
pas16, qlogic, scsi_debug, seagate, t128, u15-24f, ultrastore,
or wd7000. These directories show up for all drivers that reg-
istered at least one SCSI HBA. Every directory contains one
file per registered host. Every host-file is named after the
number the host was assigned during initialization.
Reading these files will usually show driver and host configura-
tion, statistics, etc.
Writing to these files allows different things on different
hosts. For example, with the latency and nolatency commands,
root can switch on and off command latency measurement code in
the eata_dma driver. With the lockup and unlock commands, root
can control bus lockups simulated by the scsi_debug driver.
/proc/self
This directory refers to the process accessing the /proc file
system, and is identical to the /proc directory named by the
process ID of the same process.
/proc/slabinfo
Information about kernel caches. Since Linux 2.6.16 this file
is only present if the CONFIG_SLAB kernel configuration option
is enabled. The columns in /proc/slabinfo are:
cache-name
num-active-objs
total-objs
object-size
num-active-slabs
total-slabs
num-pages-per-slab
See slabinfo(5) for details.
/proc/stat
kernel/system statistics. Varies with architecture. Common
entries include:
cpu 3357 0 4313 1362393
The amount of time, measured in units of USER_HZ
(1/100ths of a second on most architectures, use
sysconf(_SC_CLK_TCK) to obtain the right value), that the
system spent in user mode, user mode with low priority
(nice), system mode, and the idle task, respectively.
The last value should be USER_HZ times the second entry
in the uptime pseudo-file.
In Linux 2.6 this line includes three additional columns:
iowait - time waiting for I/O to complete (since 2.5.41);
irq - time servicing interrupts (since 2.6.0-test4);
softirq - time servicing softirqs (since 2.6.0-test4).
Since Linux 2.6.11, there is an eighth column, steal -
stolen time, which is the time spent in other operating
systems when running in a virtualized environment
Since Linux 2.6.24, there is a ninth column, guest, which
is the time spent running a virtual CPU for guest operat-
ing systems under the control of the Linux kernel.
page 5741 1808
The number of pages the system paged in and the number
that were paged out (from disk).
swap 1 0
The number of swap pages that have been brought in and
out.
intr 1462898
This line shows counts of interrupts serviced since boot
time, for each of the possible system interrupts. The
first column is the total of all interrupts serviced;
each subsequent column is the total for a particular
interrupt.
disk_io: (2,0):(31,30,5764,1,2) (3,0):...
(major,disk_idx):(noinfo, read_io_ops, blks_read,
write_io_ops, blks_written)
(Linux 2.4 only)
ctxt 115315
The number of context switches that the system underwent.
btime 769041601
boot time, in seconds since the Epoch (January 1, 1970).
processes 86031
Number of forks since boot.
procs_running 6
Number of processes in runnable state. (Linux 2.5.45
onwards.)
procs_blocked 2
Number of processes blocked waiting for I/O to complete.
(Linux 2.5.45 onwards.)
/proc/swaps
Swap areas in use. See also swapon(8).
/proc/sys
This directory (present since 1.3.57) contains a number of files
and subdirectories corresponding to kernel variables. These
variables can be read and sometimes modified using the /proc
file system, and the (deprecated) sysctl(2) system call.
Presently, there are subdirectories abi, debug, dev, fs, kernel,
net, proc, rxrpc, sunrpc and vm that each contain more files and
subdirectories.
/proc/sys/abi (since Linux 2.4.10)
This directory may contain files with application binary infor-
mation. See the kernel source file Documentation/sysctl/abi.txt
for more information.
/proc/sys/debug
This directory may be empty.
/proc/sys/dev
This directory contains device-specific information (e.g.,
dev/cdrom/info). On some systems, it may be empty.
/proc/sys/fs
This contains the subdirectories binfmt_misc, epoll, inotify,
and mqueue, and files dentry-state, dir-notify-enable, dquot-nr,
file-max, file-nr, inode-max, inode-nr, inode-state, lease-
break-time, leases-enable, overflowgid, overflowuid,
suid_dumpable, super-max, and super-nr.
/proc/sys/fs/binfmt_misc
Documentation for files in this directory can be found in the
kernel sources in Documentation/binfmt_misc.txt.
/proc/sys/fs/dentry-state (since Linux 2.2)
This file contains information about the status of the directory
cache (dcache). The file contains six numbers, nr_dentry,
nr_unused, age_limit (age in seconds), want_pages (pages
requested by system) and two dummy values.
* nr_dentry is the number of allocated dentries (dcache
entries). This field is unused in Linux 2.2.
* nr_unused is the number of unused dentries.
* age_limit is the age in seconds after which dcache entries can
be reclaimed when memory is short.
* want_pages is non-zero when the kernel has called
shrink_dcache_pages() and the dcache isn’t pruned yet.
/proc/sys/fs/dir-notify-enable
This file can be used to disable or enable the dnotify interface
described in fcntl(2) on a system-wide basis. A value of 0 in
this file disables the interface, and a value of 1 enables it.
/proc/sys/fs/dquot-max
This file shows the maximum number of cached disk quota entries.
On some (2.4) systems, it is not present. If the number of free
cached disk quota entries is very low and you have some awesome
number of simultaneous system users, you might want to raise the
limit.
/proc/sys/fs/dquot-nr
This file shows the number of allocated disk quota entries and
the number of free disk quota entries.
/proc/sys/fs/epoll (since Linux 2.6.28)
This directory contains the file max_user_watches, which can be
used to limit the amount of kernel memory consumed by the epoll
interface. For further details, see inotify(7).
/proc/sys/fs/file-max
This file defines a system-wide limit on the number of open
files for all processes. (See also setrlimit(2), which can be
used by a process to set the per-process limit, RLIMIT_NOFILE,
on the number of files it may open.) If you get lots of error
messages about running out of file handles, try increasing this
value:
echo 100000 > /proc/sys/fs/file-max
The kernel constant NR_OPEN imposes an upper limit on the value
that may be placed in file-max.
If you increase /proc/sys/fs/file-max, be sure to increase
/proc/sys/fs/inode-max to 3-4 times the new value of
/proc/sys/fs/file-max, or you will run out of inodes.
/proc/sys/fs/file-nr
Historically, the kernel was able to allocate file handles
dynamically, but not to free them again. The three values in
file-nr denote the number of allocated file handles, the number
of allocated but unused file handles, and the maximum number of
file handles. Linux 2.6 always reports 0 as the number of free
file handles -- this is not an error, it just means that the
number of allocated file handles exactly matches the number of
used file handles.
/proc/sys/fs/inode-max
This file contains the maximum number of in-memory inodes. On
some (2.4) systems, it may not be present. This value should be
3-4 times larger than the value in file-max, since stdin, stdout
and network sockets also need an inode to handle them. When you
regularly run out of inodes, you need to increase this value.
/proc/sys/fs/inode-nr
This file contains the first two values from inode-state.
/proc/sys/fs/inode-state
This file contains seven numbers: nr_inodes, nr_free_inodes,
preshrink, and four dummy values. nr_inodes is the number of
inodes the system has allocated. This can be slightly more than
inode-max because Linux allocates them one page full at a time.
nr_free_inodes represents the number of free inodes. preshrink
is non-zero when the nr_inodes > inode-max and the system needs
to prune the inode list instead of allocating more.
/proc/sys/fs/inotify (since Linux 2.6.13)
This directory contains files max_queued_events,
max_user_instances, and max_user_watches, that can be used to
limit the amount of kernel memory consumed by the inotify inter-
face. For further details, see inotify(7).
/proc/sys/fs/lease-break-time
This file specifies the grace period that the kernel grants to a
process holding a file lease (fcntl(2)) after it has sent a sig-
nal to that process notifying it that another process is waiting
to open the file. If the lease holder does not remove or down-
grade the lease within this grace period, the kernel forcibly
breaks the lease.
/proc/sys/fs/leases-enable
This file can be used to enable or disable file leases
(fcntl(2)) on a system-wide basis. If this file contains the
value 0, leases are disabled. A non-zero value enables leases.
/proc/sys/fs/mqueue (since Linux 2.6.6)
This directory contains files msg_max, msgsize_max, and
queues_max, controlling the resources used by POSIX message
queues. See mq_overview(7) for details.
/proc/sys/fs/overflowgid and /proc/sys/fs/overflowuid
These files allow you to change the value of the fixed UID and
GID. The default is 65534. Some file systems only support
16-bit UIDs and GIDs, although in Linux UIDs and GIDs are 32
bits. When one of these file systems is mounted with writes
enabled, any UID or GID that would exceed 65535 is translated to
the overflow value before being written to disk.
/proc/sys/fs/suid_dumpable (since Linux 2.6.13)
The value in this file determines whether core dump files are
produced for set-user-ID or otherwise protected/tainted
binaries. Three different integer values can be specified:
0 (default) This provides the traditional (pre-Linux 2.6.13)
behavior. A core dump will not be produced for a process which
has changed credentials (by calling seteuid(2), setgid(2), or
similar, or by executing a set-user-ID or set-group-ID program)
or whose binary does not have read permission enabled.
1 ("debug") All processes dump core when possible. The core
dump is owned by the file system user ID of the dumping process
and no security is applied. This is intended for system debug-
ging situations only. Ptrace is unchecked.
2 ("suidsafe") Any binary which normally would not be dumped
(see "0" above) is dumped readable by root only. This allows
the user to remove the core dump file but not to read it. For
security reasons core dumps in this mode will not overwrite one
another or other files. This mode is appropriate when adminis-
trators are attempting to debug problems in a normal environ-
ment.
/proc/sys/fs/super-max
This file controls the maximum number of superblocks, and thus
the maximum number of mounted file systems the kernel can have.
You only need to increase super-max if you need to mount more
file systems than the current value in super-max allows you to.
/proc/sys/fs/super-nr
This file contains the number of file systems currently mounted.
/proc/sys/kernel
This directory contains files controlling a range of kernel
parameters, as described below.
/proc/sys/kernel/acct
This file contains three numbers: highwater, lowwater, and fre-
quency. If BSD-style process accounting is enabled these values
control its behavior. If free space on file system where the
log lives goes below lowwater percent accounting suspends. If
free space gets above highwater percent accounting resumes.
frequency determines how often the kernel checks the amount of
free space (value is in seconds). Default values are 4, 2 and
30. That is, suspend accounting if 2% or less space is free;
resume it if 4% or more space is free; consider information
about amount of free space valid for 30 seconds.
/proc/sys/kernel/cap-bound (from Linux 2.2 to 2.6.24)
This file holds the value of the kernel capability bounding set
(expressed as a signed decimal number). This set is ANDed
against the capabilities permitted to a process during
execve(2). Starting with Linux 2.6.25, the system-wide capabil-
ity bounding set disappeared, and was replaced by a per-thread
bounding set; see capabilities(7).
/proc/sys/kernel/core_pattern
See core(5).
/proc/sys/kernel/core_uses_pid
See core(5).
/proc/sys/kernel/ctrl-alt-del
This file controls the handling of Ctrl-Alt-Del from the key-
board. When the value in this file is 0, Ctrl-Alt-Del is
trapped and sent to the init(8) program to handle a graceful
restart. When the value is greater than zero, Linux’s reaction
to a Vulcan Nerve Pinch (tm) will be an immediate reboot, with-
out even syncing its dirty buffers. Note: when a program (like
dosemu) has the keyboard in "raw" mode, the ctrl-alt-del is
intercepted by the program before it ever reaches the kernel tty
layer, and it’s up to the program to decide what to do with it.
/proc/sys/kernel/dmesg_restrict
The value in this file determines who can see kernel syslog con-
tents. A value of 0 in this file imposes no restrictions. If
the value is 1, only privileged users can read the kernel sys-
log. (See syslog(2) for more details.) Since Linux 3.4, only
users with the CAP_SYS_ADMIN capability may change the value in
this file.
/proc/sys/kernel/hotplug
This file contains the path for the hotplug policy agent. The
default value in this file is /sbin/hotplug.
/proc/sys/kernel/domainname and /proc/sys/kernel/hostname
can be used to set the NIS/YP domainname and the hostname of
your box in exactly the same way as the commands domainname(1)
and hostname(1), that is:
# echo 'darkstar' > /proc/sys/kernel/hostname
# echo 'mydomain' > /proc/sys/kernel/domainname
has the same effect as
# hostname 'darkstar'
# domainname 'mydomain'
Note, however, that the classic darkstar.frop.org has the host-
name "darkstar" and DNS (Internet Domain Name Server) domainname
"frop.org", not to be confused with the NIS (Network Information
Service) or YP (Yellow Pages) domainname. These two domain
names are in general different. For a detailed discussion see
the hostname(1) man page.
/proc/sys/kernel/htab-reclaim
(PowerPC only) If this file is set to a non-zero value, the Pow-
erPC htab (see kernel file Documentation/powerpc/ppc_htab.txt)
is pruned each time the system hits the idle loop.
/proc/sys/kernel/kptr_restrict
The value in this file determines whether kernel addresses are
exposed via /proc files and other interfaces. A value of 0 in
this file imposes no restrictions. If the value is 1, kernel
pointers printed using the %pK format specifier will be replaced
with zeros unless the user has the CAP_SYSLOG capability. If
the value is 2, kernel pointers printed using the %pK format
specifier will be replaced with zeros regardless of the user’s
capabilities. The initial default value for this file was 1,
but the default was changed to 0 in Linux 2.6.39. Since Linux
3.4, only users with the CAP_SYS_ADMIN capability can change the
value in this file.
/proc/sys/kernel/l2cr
(PowerPC only) This file contains a flag that controls the L2
cache of G3 processor boards. If 0, the cache is disabled.
Enabled if non-zero.
/proc/sys/kernel/modprobe
This file contains the path for the kernel module loader. The
default value is /sbin/modprobe. The file is only present if
the kernel is built with the CONFIG_KMOD option enabled. It is
described by the kernel source file Documentation/kmod.txt (only
present in kernel 2.4 and earlier).
/proc/sys/kernel/msgmax
This file defines a system-wide limit specifying the maximum
number of bytes in a single message written on a System V mes-
sage queue.
/proc/sys/kernel/msgmni
This file defines the system-wide limit on the number of message
queue identifiers. (This file is only present in Linux 2.4
onwards.)
/proc/sys/kernel/msgmnb
This file defines a system-wide parameter used to initialize the
msg_qbytes setting for subsequently created message queues. The
msg_qbytes setting specifies the maximum number of bytes that
may be written to the message queue.
/proc/sys/kernel/ostype and /proc/sys/kernel/osrelease
These files give substrings of /proc/version.
/proc/sys/kernel/overflowgid and /proc/sys/kernel/overflowuid
These files duplicate the files /proc/sys/fs/overflowgid and
/proc/sys/fs/overflowuid.
/proc/sys/kernel/panic
This file gives read/write access to the kernel variable
panic_timeout. If this is zero, the kernel will loop on a
panic; if non-zero it indicates that the kernel should autore-
boot after this number of seconds. When you use the software
watchdog device driver, the recommended setting is 60.
/proc/sys/kernel/panic_on_oops (since Linux 2.5.68)
This file controls the kernel’s behavior when an oops or BUG is
encountered. If this file contains 0, then the system tries to
continue operation. If it contains 1, then the system delays a
few seconds (to give klogd time to record the oops output) and
then panics. If the /proc/sys/kernel/panic file is also non-
zero then the machine will be rebooted.
/proc/sys/kernel/pid_max( since Linux 2.5.34)
This file specifies the value at which PIDs wrap around (i.e.,
the value in this file is one greater than the maximum PID).
The default value for this file, 32768, results in the same
range of PIDs as on earlier kernels. On 32-bit platforms, 32768
is the maximum value for pid_max. On 64-bit systems, pid_max
can be set to any value up to 2^22 (PID_MAX_LIMIT, approximately
4 million).
/proc/sys/kernel/powersave-nap (PowerPC only)
This file contains a flag. If set, Linux-PPC will use the "nap"
mode of powersaving, otherwise the "doze" mode will be used.
/proc/sys/kernel/printk
The four values in this file are console_loglevel, default_mes-
sage_loglevel, minimum_console_level, and default_con-
sole_loglevel. These values influence printk() behavior when
printing or logging error messages. See syslog(2) for more info
on the different loglevels. Messages with a higher priority
than console_loglevel will be printed to the console. Messages
without an explicit priority will be printed with priority
default_message_level. minimum_console_loglevel is the minimum
(highest) value to which console_loglevel can be set.
default_console_loglevel is the default value for con-
sole_loglevel.
/proc/sys/kernel/pty (since Linux 2.6.4)
This directory contains two files relating to the number of Unix
98 pseudo-terminals (see pts(4)) on the system.
/proc/sys/kernel/pty/max
This file defines the maximum number of pseudo-terminals.
/proc/sys/kernel/pty/nr
This read-only file indicates how many pseudo-terminals are cur-
rently in use.
/proc/sys/kernel/random
This directory contains various parameters controlling the oper-
ation of the file /dev/random. See random(4) for further infor-
mation.
/proc/sys/kernel/real-root-dev
This file is documented in the kernel source file Documenta-
tion/initrd.txt.
/proc/sys/kernel/reboot-cmd (Sparc only)
This file seems to be a way to give an argument to the SPARC
ROM/Flash boot loader. Maybe to tell it what to do after
rebooting?
/proc/sys/kernel/rtsig-max
(Only in kernels up to and including 2.6.7; see setrlimit(2))
This file can be used to tune the maximum number of POSIX real-
time (queued) signals that can be outstanding in the system.
/proc/sys/kernel/rtsig-nr
(Only in kernels up to and including 2.6.7.) This file shows
the number POSIX real-time signals currently queued.
/proc/sys/kernel/sem (since Linux 2.4)
This file contains 4 numbers defining limits for System V IPC
semaphores. These fields are, in order:
SEMMSL The maximum semaphores per semaphore set.
SEMMNS A system-wide limit on the number of semaphores in all
semaphore sets.
SEMOPM The maximum number of operations that may be specified
in a semop(2) call.
SEMMNI A system-wide limit on the maximum number of semaphore
identifiers.
/proc/sys/kernel/sg-big-buff
This file shows the size of the generic SCSI device (sg) buffer.
You can’t tune it just yet, but you could change it at compile
time by editing include/scsi/sg.h and changing the value of
SG_BIG_BUFF. However, there shouldn’t be any reason to change
this value.
/proc/sys/kernel/shmall
This file contains the system-wide limit on the total number of
pages of System V shared memory.
/proc/sys/kernel/shmmax
This file can be used to query and set the run-time limit on the
maximum (System V IPC) shared memory segment size that can be
created. Shared memory segments up to 1GB are now supported in
the kernel. This value defaults to SHMMAX.
/proc/sys/kernel/shmmni
(available in Linux 2.4 and onwards) This file specifies the
system-wide maximum number of System V shared memory segments
that can be created.
/proc/sys/kernel/sysrq
This file controls the functions allowed to be invoked by the
SysRq key. By default, the file contains 1 meaning that every
possible SysRq request is allowed (in older kernel versions,
SysRq was disabled by default, and you were required to specifi-
cally enable it at run-time, but this is not the case any more).
Possible values in this file are:
0 - disable sysrq completely
1 - enable all functions of sysrq
>1 - bitmask of allowed sysrq functions, as follows:
2 - enable control of console logging level
4 - enable control of keyboard (SAK, unraw)
8 - enable debugging dumps of processes etc.
16 - enable sync command
32 - enable remount read-only
64 - enable signalling of processes (term, kill, oom-
kill)
128 - allow reboot/poweroff
256 - allow nicing of all real-time tasks
This file is only present if the CONFIG_MAGIG_SYSRQ kernel con-
figuration option is enabled. For further details see the ker-
nel source file Documentation/sysrq.txt.
/proc/sys/kernel/version
This file contains a string like:
#5 Wed Feb 25 21:49:24 MET 1998
The "#5" means that this is the fifth kernel built from this
source base and the date behind it indicates the time the kernel
was built.
/proc/sys/kernel/threads-max (since Linux 2.3.11)
This file specifies the system-wide limit on the number of
threads (tasks) that can be created on the system.
/proc/sys/kernel/zero-paged (PowerPC only)
This file contains a flag. When enabled (non-zero), Linux-PPC
will pre-zero pages in the idle loop, possibly speeding up
get_free_pages.
/proc/sys/net
This directory contains networking stuff. Explanations for some
of the files under this directory can be found in tcp(7) and
ip(7).
/proc/sys/net/core/somaxconn
This file defines a ceiling value for the backlog argument of
listen(2); see the listen(2) manual page for details.
/proc/sys/proc
This directory may be empty.
/proc/sys/sunrpc
This directory supports Sun remote procedure call for network
file system (NFS). On some systems, it is not present.
/proc/sys/vm
This directory contains files for memory management tuning,
buffer and cache management.
/proc/sys/vm/drop_caches (since Linux 2.6.16)
Writing to this file causes the kernel to drop clean caches,
dentries and inodes from memory, causing that memory to become
free.
To free pagecache, use echo 1 > /proc/sys/vm/drop_caches; to
free dentries and inodes, use echo 2 > /proc/sys/vm/drop_caches;
to free pagecache, dentries and inodes, use echo 3 >
/proc/sys/vm/drop_caches.
Because this is a non-destructive operation and dirty objects
are not freeable, the user should run sync(8) first.
/proc/sys/vm/swappiness
The value in this file controls how aggressively the kernel will
swap memory pages. Higher values increase agressiveness, lower
values descrease aggressiveness. The default value is 60.
/proc/sys/vm/legacy_va_layout (since Linux 2.6.9)
If non-zero, this disables the new 32-bit memory-mapping layout;
the kernel will use the legacy (2.4) layout for all processes.
/proc/sys/vm/oom_dump_tasks (since Linux 2.6.25)
Enables a system-wide task dump (excluding kernel threads) to be
produced when the kernel performs an OOM-killing. The dump
includes the following information for each task (thread, pro-
cess): thread ID, real user ID, thread group ID (process ID),
virtual memory size, resident set size, the CPU that the task is
scheduled on, oom_adj score (see the description of
/proc/[pid]/oom_adj), and command name. This is helpful to
determine why the OOM-killer was invoked and to identify the
rogue task that caused it.
If this contains the value zero, this information is suppressed.
On very large systems with thousands of tasks, it may not be
feasible to dump the memory state information for each one.
Such systems should not be forced to incur a performance penalty
in OOM situations when the information may not be desired.
If this is set to non-zero, this information is shown whenever
the OOM-killer actually kills a memory-hogging task.
The default value is 0.
/proc/sys/vm/oom_kill_allocating_task (since Linux 2.6.24)
This enables or disables killing the OOM-triggering task in out-
of-memory situations.
If this is set to zero, the OOM-killer will scan through the
entire tasklist and select a task based on heuristics to kill.
This normally selects a rogue memory-hogging task that frees up
a large amount of memory when killed.
If this is set to non-zero, the OOM-killer simply kills the task
that triggered the out-of-memory condition. This avoids a pos-
sibly expensive tasklist scan.
If /proc/sys/vm/panic_on_oom is non-zero, it takes precedence
over whatever value is used in /proc/sys/vm/oom_kill_allocat-
ing_task.
The default value is 0.
/proc/sys/vm/overcommit_memory
This file contains the kernel virtual memory accounting mode.
Values are:
0: heuristic overcommit (this is the default)
1: always overcommit, never check
2: always check, never overcommit
In mode 0, calls of mmap(2) with MAP_NORESERVE are not checked,
and the default check is very weak, leading to the risk of get-
ting a process "OOM-killed". Under Linux 2.4 any non-zero value
implies mode 1. In mode 2 (available since Linux 2.6), the
total virtual address space on the system is limited to (SS +
RAM*(r/100)), where SS is the size of the swap space, and RAM is
the size of the physical memory, and r is the contents of the
file /proc/sys/vm/overcommit_ratio.
/proc/sys/vm/overcommit_ratio
See the description of /proc/sys/vm/overcommit_memory.
/proc/sys/vm/panic_on_oom (since Linux 2.6.18)
This enables or disables a kernel panic in an out-of-memory sit-
uation.
If this file is set to the value 0, the kernel’s OOM-killer will
kill some rogue process. Usually, the OOM-killer is able to
kill a rogue process and the system will survive.
If this file is set to the value 1, then the kernel normally
panics when out-of-memory happens. However, if a process limits
allocations to certain nodes using memory policies (mbind(2)
MPOL_BIND) or cpusets (cpuset(7)) and those nodes reach memory
exhaustion status, one process may be killed by the OOM-killer.
No panic occurs in this case: because other nodes’ memory may be
free, this means the system as a whole may not have reached an
out-of-memory situation yet.
If this file is set to the value 2, the kernel always panics
when an out-of-memory condition occurs.
The default value is 0. 1 and 2 are for failover of clustering.
Select either according to your policy of failover.
/proc/sysrq-trigger (since Linux 2.4.21)
Writing a character to this file triggers the same SysRq func-
tion as typing ALT-SysRq- (see the description of
/proc/sys/kernel/sysrq). This file is normally only writable by
root. For further details see the kernel source file Documenta-
tion/sysrq.txt.
/proc/sysvipc
Subdirectory containing the pseudo-files msg, sem and shm.
These files list the System V Interprocess Communication (IPC)
objects (respectively: message queues, semaphores, and shared
memory) that currently exist on the system, providing similar
information to that available via ipcs(1). These files have
headers and are formatted (one IPC object per line) for easy
understanding. svipc(7) provides further background on the
information shown by these files.
/proc/tty
Subdirectory containing the pseudo-files and subdirectories for
tty drivers and line disciplines.
/proc/uptime
This file contains two numbers: the uptime of the system (sec-
onds), and the amount of time spent in idle process (seconds).
/proc/version
This string identifies the kernel version that is currently run-
ning. It includes the contents of /proc/sys/kernel/ostype,
/proc/sys/kernel/osrelease and /proc/sys/kernel/version. For
example:
Linux version 1.0.9 (quinlan@phaze) #1 Sat May 14 01:51:54 EDT 1994
/proc/vmstat (since Linux 2.6)
This file displays various virtual memory statistics.
/proc/zoneinfo (since Linux 2.6.13)
This file display information about memory zones. This is use-
ful for analyzing virtual memory behavior.
NOTES
Many strings (i.e., the environment and command line) are in the inter-
nal format, with sub-fields terminated by null bytes ('\0'), so you may
find that things are more readable if you use od -c or tr "\000" "\n"
to read them. Alternatively, echo `cat ` works well.
This manual page is incomplete, possibly inaccurate, and is the kind of
thing that needs to be updated very often.
SEE ALSO
cat(1), find(1), free(1), ps(1), tr(1), uptime(1), chroot(2), mmap(2),
readlink(2), syslog(2), slabinfo(5), hier(7), time(7), arp(8),
dmesg(8), hdparm(8), ifconfig(8), init(8), lsmod(8), lspci(8),
mount(8), netstat(8), procinfo(8), route(8)
The kernel source files: Documentation/filesystems/proc.txt, Documenta-
tion/sysctl/vm.txt
COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2009-03-30 PROC(5)