NAME
proc - 进程信息伪文件系统
描述
/proc 是一个伪文件系统, 被用作内核数据结构的接口, 而不仅仅是解释说明 /dev/kmem. /proc里的大多数文件都是只读的, 但也可以通过写一些文件来改变内核变量.
下面对整个 /proc 目录作一个大略的介绍.
- [number]
- 在 /proc 目录里, 每个正在运行的进程都有一个以该进程 ID 命名的子目录, 其下包括如下的目录和伪文件.
- cmdline
- 该文件保存了进程的完整命令行. 如果该进程已经被交换出内存, 或者该进程已经僵死, 那么就没有任何东西在该文件里, 这时候对该文件的读操作将返回零个字符. 该文件以空字符 null 而不是换行符作为结束标志.
- cwd
- 一个符号连接, 指向进程当前的工作目录. 例如, 要找出进程 20 的 cwd, 你可以:
cd /proc/20/cwd; /bin/pwd
请注意 pwd 命令通常是 shell 内置的, 在这样的情况下可能工作得不是很好.
- environ
- 该文件保存进程的环境变量, 各项之间以空字符分隔, 结尾也可能是一个空字符. 因此, 如果要输出进程 1 的环境变量, 你应该:
(cat /proc/1/environ; echo) | tr ";\000"; ";\n";
(至于为什么想要这么做, 请参阅 lilo(8).)
- exe
- 也是一个符号连接, 指向被执行的二进制代码.
在 Linux 2.0 或者更早的版本下, 对 exe 特殊文件的 readlink(2) 返回一个如下格式的字符串:
[设备号]:节点号
举个例子, [0301]:1502 就是某设备的 1502 节点, 该设备的主设备号为 03 (如 IDE, MFM 等驱动器), 从设备号为 01 (第一个驱动器的第一分区).
而在 Linux 2.2 下, readlink(2) 则给出命令的实际路径名.
另外, 该符号连接也可以正常析引用(试图打开 exe 文件实际上将打开一个可执行文件). 你甚至可以键入 /proc/[number]/exe 来运行 [number] 进程的副本.
带 -inum 选项的 find(1) 命令可以定位该文件.
- fd
- 进程所打开的每个文件都有一个符号连接在该子目录里, 以文件描述符命名, 这个名字实际上是指向真正的文件的符号连接,(和 exe 记录一样).例如, 0 是标准输入, 1 是标准输出, 2 是标准错误, 等等.
程序有时可能想要读取一个文件却不想要标准输入,或者想写到一个文件却不想将输出送到标准输出去,那么就可以很有效地用如下的办法骗过(假定 -i 是输入文件的标志, 而 -o 是输出文件的标志):
foobar -i /proc/self/fd/0 -o /proc/self/fd/1 ...
这样就是一个能运转的过滤器. 请注意该方法不能用来在文件里搜索, 这是因为 fd 目录里的文件是不可搜索的.在 UNIX 类的系统下, /proc/self/fd/N 基本上就与 /dev/fd/N 相同. 实际上, 大多数的 Linux MAKEDEV 脚本都将 /dev/fd 符号连接到 [..]/proc/self/fd 上.
- maps
- 该文件包含当前的映象内存区及他们的访问许可.
格式如下:
address perms offset dev inode 00000000-0002f000 r-x-- 00000400 03:03 1401 0002f000-00032000 rwx-p 0002f400 03:03 1401 00032000-0005b000 rwx-p 00000000 00:00 0 60000000-60098000 rwx-p 00000400 03:03 215 60098000-600c7000 rwx-p 00000000 00:00 0 bfffa000-c0000000 rwx-p 00000000 00:00 0
address 是进程所占据的地址空间, perms 是权限集:
r = read w = write x = execute s = shared p = private (copy on write)
offset 是文件或者别的什么的偏移量, dev 是设备号(主设备号:从设备号), 而 inode 则是设备的节点号. 0 表明没有节点与内存相对应, 就象 bss 的情形.
在 Linux 2.2 下还增加了一个域给可用的路径名.
- mem
- 该文件并不是 mem (1:1) 设备, 尽管它们有相同的设备号. /dev/mem 设备是做任何地址转换之前的物理内存, 而这里的 mem 文件是访问它的进程的内存.目前这个 mem 还不能 mmap(2) (内存映射)出去,而且可能一直要等到内核中增加了一个通用的 mmap(2) 以后才能实现. (也许在你读本手册页时这一切已经发生了)
- mmap
- mmap(2) 做的 maps 映射目录,是和 exe, fd/* 等类似的符号连接. 请注意 maps 包含了比 /proc/*/mmap 更多的信息, 所以应该废弃 mmap.
";0"; 通常指 libc.so.4.
在 linux 内核 1.1.40 里, /proc/*/mmap 被取消了. (现在是 真的 废弃不用了!)
- root
- 依靠系统调用 chroot(2), unix 和 linux 可以让每个进程有各自的文件系统根目录. 由 chroot(2) 系统调用设置.根指向文件系统的根,性质就象 exe, fd/* 等一样.
- stat
- 进程状态信息, 被命令 ps(1) 使用.
现将该文件里各域, 以及他们的 scanf(3) 格式说明符, 按顺序分述如下:
- pid %d
- 进程标识.
- comm %s
- 可执行文件的文件名, 包括路径. 该文件是否可见取决于该文件是否已被交换出内存.
- state %c
- ";RSDZT"; 中的一个, R 是正在运行, S 是在可中断的就绪态中睡眠, D 是在不可中断的等待或交换态中睡眠, Z 是僵死, T 是被跟踪或被停止(由于收到信号).
- ppid %d
- 父进程 PID.
- pgrp %d
- 进程的进程组 ID.
- session %d
- 进程的会话 ID.
- tty %d
- 进程所使用终端.
- tpgid %d
- 当前拥有该进程所连接终端的进程所在的进程组 ID.
- flags %u
- 进程标志. 目前每个标志都设了数学位, 所以输出里就不包括该位. crt0.s 检查数学仿真这可能是一个臭虫, 因为不是每个进程都是用 c 编译的程序. 数学位应该是十进制的 4, 而跟踪位应该是十进制的 10.
- minflt %u
- 进程所导致的小错误(minor faults)数目, 这样的小错误(minor faults)不需要从磁盘重新载入一个内存页.
- cminflt %u
- 进程及其子进程所导致的小错误(minor faults)数目.
- majflt %u
- 进程所导致的大错误(major faults)数目, 这样的大错误(major faults)需要重新载入内存页.
- cmajflt %u
- 进程及其子进程所导致的大错误(major faults)数目.
- utime %d
- 进程被调度进用户态的时间(以 jiffy 为单位, 1 jiffy=1/100 秒,另外不同硬件体系略有不同).
- stime %d
- 进程被调度进内核态的时间, 以 jiffy 为单位.
- cutime %d
- 进程及其子进程被调度进用户态的时间, 以 jiffy 为单位.
- cstime %d
- 进程及其子进程被调度进内核态的时间, 以 jiffy 为单位.
- counter %d
- 如果进程不是当前正在运行的进程, 就是进程在下个时间片当前可以拥有的最大时间, 以 jiffy 为单位. 如果进程是当前正在运行的进程, 就是当前时间片中所剩下 jiffy 数目.
- priority %d
- 标准优先数只再加上 15, 在内核里该值总是正的.
- timeout %u
- 当前至进程的下一次间歇时间, 以 jiffy 为单位.
- itrealvalue %u
- 由于计时间隔导致的下一个 SIGALRM 发送进程的时延,以 jiffy 为单位.
- starttime %d
- 进程自系统启动以来的开始时间, 以 jiffy 为单位.
- vsize %u
- 虚拟内存大小.
- rss %u
- Resident Set Size(驻留大小): 进程所占用的真实内存大小, 以页为单位, 为便于管理而减去了 3. rss 只包括正文, 数据以及堆栈的空间, 但不包括尚未要求装入内存的或已被交换出去的.
- rlim %u
- 当前进程的 rss 限制, 以字节为单位, 通常为 2,147,483,647.
- startcode %u
- 正文部分地址下限.
- endcode %u
- 正文部分地址上限.
- startstack %u
- 堆栈开始地址.
- kstkesp %u
- esp(32 位堆栈指针) 的当前值, 与在进程的内核堆栈页得到的一致.
- kstkeip %u
- EIP(32 位指令指针)的当前值.
- signal %d
- 待处理信号的 bitmap(通常为 0).
- blocked %d
- 被阻塞信号的 bitmap(对 shell 通常是 0, 2).
- sigignore %d
- 被忽略信号的 bitmap.
- sigcatch %d
- 被俘获信号的 bitmap.
- wchan %u
- 进程在其中等待的通道, 实际是一个系统调用的地址. 如果你需要文本格式的, 也可以在名字列表中找到. (如果有最新版本的 /etc/psdatabase, 你可以在 ps -l 的结果中的 WCHAN 域看到)
- cpuinfo
- 保存了CPU 以及体系架构依赖条目的列表. 对于不同的系统架构有不同的列表, 共有的两项是 cpu 和 BogoMIPS, cpu 可能是当前在用的 CPU, 而 BogoMIPS 则是内核初始化时计算出的一个系统常数.
- devices
- 主设备号及设备组的列表, 文本格式. MAKEDEV 脚本使用该文件来维持内核的一致性.
- dma
- 一个列表, 指出正在使用的ISA DMA (直接内存访问)通道.
- filesystems
- 以文本格式列出了被编译进内核的文件系统. 当没有给 mount(1) 指明哪个文件系统的时候, mount(1) 就依靠该文件遍历不同的文件系统.
- interrupts
- 该文件以 ASCII 格式记录了(至少是在 i386 体系上的)每次 IRQ 的中断数目.
- ioports
- 该文件列出了当前在用的已注册 I/O 端口范围.
- kcore
- 该伪文件以 core 文件格式给出了系统的物理内存映象, 再利用未卸载的内核 (/usr/src/linux/tools/zSystem), 我们就可以用 GDB 查探当前内核的任意数据结构.
该文件的总长度是物理内存 (RAM) 的大小再加上 4KB.
- kmsg
- 可以用该文件取代系统调用 syslog(2) 来记录内核信息. 但是读该文件需要超级用户权限, 并且一次只能有一个进程可以读该文件, 因而如果一个使用了 syslog(2) 系统调用功能来记录内核信息的系统日志进程正在运行的话, 别的进程就不能再去读该伪文件了.
该文件的内容可以用 dmesg(8) 来察看.
- ksyms
- 该文件保存了内核输出的符号定义, modules(X) 使用该文件动态地连接和捆绑可装载的模块.
- loadavg
- 平均负载数给出了在过去的 1, 5, 15 分钟里在运行队列里的任务数, 与 uptime(1) 等命令的结果相同.
- locks
- 这个文件显示当前文件锁.
- malloc
- 只有在编译时定义了 CONFIGDEBUGMALLOC 才会有该文件.
- meminfo
- free(1) 利用该文件来给出系统总的空闲内存和已用内存 (包括物理内存和交换内存), 以及内核所使用的共享内存和缓冲区.
该文件与 free(1) 格式相同, 但是以字节为单位而不是 KB.
- modules
- 列出了系统已载入的模块, 文本格式.
- net
- 该子目录包括多个 ASCII 格式的网络伪文件, 描述了网络层的部分情况. 可以用 cat 来察看这些文件, 但标准的 netstat(8) 命令组更清晰地给出了这些文件的信息.
- arp
- 该文件以 ASCII 格式保存了内核 ARP 表, 用于地址解析, 包括静态和动态 arp 数据. 文件格式如下:
IP address HW type Flags HW address 10.11.100.129 0x1 0x6 00:20:8A:00:0C:5A 10.11.100.5 0x1 0x2 00:C0:EA:00:00:4E 44.131.10.6 0x3 0x2 GW4PTS
其中 'IP address' 是机器的 IPv4 地址; 'HW type' 是地址的硬件类型, 遵循 RFC 826; flags 是 ARP 结构的内部标志, 在 /usr/include/linux/if_arp.h 中定义; 'HW address' 是该 IP 地址的物理层映射(如果知道的话).
- dev
- 该伪文件包含网络设备状态信息, 给出了发送和收到的包的数目, 错误和冲突的数目, 以及别的一些基本统计数据. ifconfig(8) 利用了该文件来报告网络设备状态. 文件格式如下:
Inter-| Receive | Transmit face |packets errs drop fifo frame|packets errs drop fifo colls carrier lo: 0 0 0 0 0 2353 0 0 0 0 0 eth0: 644324 1 0 0 1 563770 0 0 0 581 0
- ipx
- 无信息.
- ipx_route
- 无信息.
- rarp
- 该文件具有和 arp 同样的格式, 包含当前的逆向地址映射数据. rarp(8) 利用这些数据来作逆向地址查询服务. 只有将 RARP 配置进内核, 该文件才存在.
- raw
- 该文件保存了 RAW 套接字表, 大部分信息除用于调试以外没有什么用. 包括本地地址和协议号对; "St" 是套接字的内部状态; tx_queue 和 rx_queue 是内核存储器使用意义上的输入输出数据队列; RAW 没有使用"tr", "tm->when" 和 "rexmits"; uid 是套接字创建者的有效 uid.
- route
- 没有信息, 但是看上去类似于 route(8)
- snmp
- 该文件以 ASCII 格式保存了 IP, ICMP, TCP 以及 UDP 管理所需的数据信息, 基于 snmp 协议. TCP mib (TCP 管理数据库)尚未完善, 可能在 1.2.0 内核能够完成.
- tcp
- 该文件保存了 TCP 套接字表, 大部分信息除用于调试以外没有什么用. "sl" 指出了套接字的内核散列槽号; "local address" 包括本地地址和端口号; "remote address" 包括远地地址和端口号(如果有连接的话); 'St' 是套接字的内部状态; 'tx_queue' 和 'rx_queue' 是内核存储器使用意义上的输入输出数据队列; "tr", "tm->when" 和 "rexmits" 保存了内核套接字声明的内部信息, 只用于调试; uid 是套接字创建者的有效 uid.
- udp
- 该文件保存了 UDP 套接字表, 大部分信息除用于调试以外没有什么用. "sl" 指出了套接字的内核散列槽号; "local address" 包括本地地址和端口号; "remote address" 包括远地地址和端口号(如果有连接的话); "St" 是套接字的内部状态; "tx_queue" 和 "rx_queue" 是内核存储器使用意义上的输入输出数据队列; UDP 没有使用 "tr","tm->when" 和 "rexmits"; 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
- unix
- 列出了当前系统的UNIX域套接字以及它们的状态, 格式如下:
Num RefCount Protocol Flags Type St Path 0: 00000002 00000000 00000000 0001 03 1: 00000001 00000000 00010000 0001 01 /dev/printer
当前总是 0; 'Flags' 是内核标志, 指出了套接字的状态; 'Type' 当前总是 1(在内核中尚未支持 unix 域数据报套接字); 'St' 是套接字内部状态; 'Path' 套接字绑捆的路径(如果有的话).
- pci
- 该文件列出了内核初始化时发现的所有 PCI 设备及其配置.
- scsi
- 该目录包括 scsi 中间层伪文件及各种 SCSI 底层驱动器子目录, 对系统中每个 SCSI host, 子目录中都存在一个文件与之对应, 展示了部分 SCSI IO 子系统的状态. 这些文件是 ASCII 格式的, 可用cat阅读.
你也可以通过写其中某些文件来重新配置该子系统, 开关一些功能.
- scsi
- 该文件列出了内核掌握的所有 SCSI 设备, 其内容就和系统启动时所看到的类似. 目前 scsi 只支持 singledevice命令, 该命令允许 root 添加一个热插拔(hotplugged)设备到一个已知设备列表中.
命令 echo 'scsi singledevice 1 0 5 0' > /proc/scsi/scsi 令 host scsi1 扫描 SCSI 通道 0, 看在 ID 5 LUN 0 是否存在设备, 如果在该地址存在设备, 或者该地址无效, 则返回一个错误.
- drivername
- 目前 drivername 可包含: NCR53c7xx, aha152x, aha1542, aha1740, aic7xxx, buslogic, eata_dma, eata_pio, fdomain, in2000, pas16, qlogic, scsi_debug, seagate, t128, u15-24f, ultrastore 或者 wd7000. 这些目录展示那些至少注册了一个 SCSI HBA 的驱动. 而对每个已注册的 host, 每个目录中都包含一个文件与之对应, 而这些对应的 host 文件就以初始化时分配给 host 的数字来命名.
这些文件给出了驱动程序以及设备的配置, 统计数据等.
可以通过写这些文件实现不同的 host 上做不同的工作. 例如, root 可以用 latency 和 nolatency 命令打开或者关闭 eata_dma 驱动器上测量延时的代码, 也可以用 lockup 和 unlock 命令控制 scsi_debug 驱动器所模拟的总线锁操作.
- self
- 当某进程访问 /proc 目录时, 该目录就指向 /proc 下以该进程 ID 命名的目录.
- stat
- 内核及系统的统计数据.
- cpu 3357 0 4313 1362393
- 系统分别消耗在用户模式, 低优先权的用户模式(nice), 系统模式, 以及空闲任务的时间, 以 jiffy 为单位. 最后一个数值应该是 uptime 伪文件第二个数值的 100 倍.
- disk 0 0 0 0
- 目前并没有实现这四个磁盘记录, 我甚至认为就不应该实现它,这是由于在别的机器上内核统计通常依赖转换率及每秒 I/O 数, 而这令每个驱动器只能有一个域.
- page 5741 1808
- 系统(从磁盘)交换进的页数和交换出去的页数.
- swap 1 0
- 取入的交换页及被取出的交换页的页数.
- intr 1462898
- 系统自启动以来所收到的中断数.
- ctxt 115315
- 系统所作的进程环境切换次数.
- btime 769041601
- 系统自 1970 年 1 月 1 号以来总的运行时间, 以秒为单位.
- sys
- 该目录在 1.3.57 的内核里开始出现, 包含一些对应于内核变量的文件和子目录. 你可以读这些变量, 有的也可以通过proc修改, 或者用系统调用 sysctl(2) 修改. 目前该目录下有如下三个子目录: kernel;, ;net;, ;vm 每个各自包括一些文件和子目录.
- kernel
- 该目录包括如下文件: domainname;, ;file-max;, ;file-nr;, ;hostname;, ; inode-max;, ;inode-nr;, ;osrelease;, ;ostype;, ; panic;, ;real-root-dev;, ;securelevel;, ;version, 由文件名就可以清楚地得知各文件功能.
只读文件 file-nr 给出当前打开的文件数.
文件 file-max 给出系统所容许的最大可打开文件数. 如果 1024 不够大的话, 可以
echo 4096 > /proc/sys/kernel/file-max
类似地, 文件 inode-nr 以及文件 inode-max 指出了当前 inode 数和最大 inode 数.
文件 ostype;, ;osrelease;, ;version 实际上是 /proc/version 的子字串.
文件 panic 可以对内核变量 panic_timeout 进行读/写访问.如果该值为零, 内核在 panic 时进入(死)循环; 如果非零, 该值指出内核将自动重起的时间, 以秒为单位.
文件 securelevel 目前似乎没什么意义 - root 无所不能.
- uptime
- 该文件包含两个数: 系统正常运行时间和总的空闲时间, 都以秒为单位.
- version
- 指明了当前正在运行的内核版本, 例如:
Linux version 1.0.9 (quinlan@phaze) #1 Sat May 14 01:51:54 EDT 1994
又见
cat(1), find(1), free(1), mount(1), ps(1), tr(1), uptime(1), readlink(2), mmap(2), chroot(2), syslog(2), hier(7), arp(8), dmesg(8), netstat(8), route(8), ifconfig(8), procinfo(8)等等.
#p#
NAME
proc - process information pseudo-filesystem
DESCRIPTION
The proc filesystem is a pseudo-filesystem which is used as an interface 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/[number]
- There is a numerical subdirectory for each running process; the subdirectory is named by the process ID. Each contains the following pseudo-files and directories.
- /proc/[number]/cmdline
- This holds the complete command line for the process, unless the whole process has been swapped out, or unless the process is a zombie. In either of these later cases, there is nothing in this file: i.e. a read on this file will return 0 characters. The command line arguments appear in this file as a set of null-separated strings, with a further null byte after the last string.
- /proc/[number]/cwd
- This is a link to the current working directory of the process. To find out the cwd of process 20, for instance, you can do this:
cd /proc/20/cwd; /bin/pwd
Note that the pwd command is often a shell builtin, and might not work properly. In bash, you may use pwd -P.
- /proc/[number]/environ
- This file contains the environment for the process. The entries are separated by null characters, and there may be a null character at the end. Thus, to print out the environment of process 1, you would do:
(cat /proc/1/environ; echo) | tr "\000" "\n"
(For a reason why one should want to do this, see lilo(8).)
- /proc/[number]/exe
- Under Linux 2.2 and 2.4 exe is a symbolic link containing the actual path name of the executed command. The exe symbolic link can be dereferenced normally - attempting to open exe will open the executable. You can even type /proc/[number]/exe to run another copy of the same process as [number].
Under Linux 2.0 and earlier exe is a pointer to the binary which was executed, and appears as a symbolic link. A readlink(2) call on the exe special 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/[number]/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 (as the exe entry does). Thus, 0 is standard input, 1 standard output, 2 standard error, etc.
Programs that will take a filename, but will not take the standard input, and which write to a file, but will not send their output to standard output, can be effectively foiled this way, assuming 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. Note that this will not work for programs that seek on their files, as the files in the fd directory are not seekable./proc/self/fd/N is approximately the same as /dev/fd/N in some UNIX and UNIX-like systems. Most Linux MAKEDEV scripts symbolically link /dev/fd to /proc/self/fd, in fact.
- /proc/[number]/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.
Under Linux 2.0 there is no field giving pathname.
- /proc/[number]/mem
- Via the mem file one can access the pages of a process's memory through open(2), read(2), and fseek(3).
- /proc/[number]/root
- Unix and Linux support the idea of a per-process root of the filesystem, set by the chroot(2) system call. Root points to the file system root, and behaves as exe, fd/*, etc. do.
- /proc/[number]/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 specifiers, 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 zombie, 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 tty the process uses.
- tpgid %d
- The process group ID of the process which currently owns the tty that the process is connected to.
- flags %lu
- The flags of the process. The math bit is decimal 4, and the traced bit is decimal 10.
- 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
- The number of jiffies that this process has been scheduled in user mode.
- stime %lu
- The number of jiffies that this process has been scheduled in kernel mode.
- cutime %ld
- The number of jiffies that this process's waited-for children have been scheduled in user mode. (See also times(2).)
- cstime %ld
- The number of jiffies that this process' waited-for children have been scheduled in kernel mode.
- priority %ld
- The standard nice value, plus fifteen. The value is never negative in the kernel.
- nice %ld
- The nice value ranges from 19 (nicest) to -19 (not nice to others).
- 0 %ld This value is hard coded to 0 as a placeholder for a removed field.
- itrealvalue %ld
- The time in jiffies before the next SIGALRM is sent to the process due to an interval timer.
- starttime %lu
- 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, minus 3 for administrative purposes. 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.
- rlim %lu
- Current limit in bytes on the rss of the process (usually 4294967295 on i386).
- 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 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 (usually 0).
- blocked %lu
- The bitmap of blocked signals (usually 0, 2 for shells).
- sigignore %lu
- The bitmap of ignored signals.
- sigcatch %lu
- The bitmap of catched signals.
- wchan %lu
- This is the "channel" in which the process is waiting. 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.
- exit_signal %d
- Signal to be sent to parent when we die.
- processor %d
- CPU number last executed on.
- /proc/[number]/statm
- Provides information about memory status in pages. The columns are:
size total program size
resident resident set size
share shared pages
trs text (code)
drs data/stack
lrs library
dt dirty pages - /proc/[number]/status
- Provides much of the information in /proc/[number]/stat and /proc/[number]/statm in a format that's easier for humans to parse.
- /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(1).
- /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/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 filesystems which were compiled into the kernel. Incidentally, this is used by mount(1) to cycle through different filesystems when none is specified.
- /proc/fs
- Empty subdirectory.
- /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 hexidecimal media media type model manufacturer's model number settings drive settings smart_thresholds in hexidecimal smart_values in hexidecimal
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 each IRQ on (at least) the i386 architechure. 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/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 messages.
Information in this file is retrieved with the dmesg(8) program.
- /proc/ksyms
- This holds the kernel exported symbol definitions used by the modules(X) tools to dynamically link and bind loadable modules.
- /proc/loadavg
- The load average numbers give 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.
- /proc/locks
- This file shows current file locks (flock(2) and fcntl(2)) and leases (fcntl(2)).
- /proc/malloc
- This file is only present if CONFIGDEBUGMALLOC was defined during compilation.
- /proc/meminfo
- This is used by free(1) to report the amount of free and used memory (both physical and swap) on the system as well as the shared memory and buffers used by the kernel.
It is in the same format as free(1), except in bytes rather than KB.
- /proc/mounts
- This is a list of all the file systems currently mounted on the system. The format of this file is documented in fstab(5).
- /proc/modules
- A text list of the modules that have been loaded by the system. See also lsmod(8).
- /proc/mtrr
- Memory Type Range Registers. See /usr/src/linux/Documentation/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 structures and are, therefore, readable with cat. 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 ifterface_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 kernel 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 creator euid 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 kernel hash slot for the socket, the "local address" is the local address and port number pair. The "remote address" is the remote address and port number pair (if connected). '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 hold internal information of the kernel socket state and are only useful for debugging. The uid field holds the creator euid 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 kernel hash slot for the socket, the "local address" is the local address and port number pair. The "remote address" is the remote address and port number pair (if connected). "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 UDP. The uid field holds the creator euid 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 datagram 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 initialization and their configuration.
- /proc/scsi
- A directory with the scsi midlevel pseudo-file and various SCSI lowlevel 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.
You can also write to some of the files to reconfigure the subsystem 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 currently supports only the add-single-device command which allows root to add a hotplugged device to the list of known devices.
An 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 registered 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 configuration, 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 filesystem, and is identical to the /proc directory named by the process ID of the same process.
- /proc/slabinfo
- Information about kernel caches. The columns 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 number of jiffies (1/100ths of a second) 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 100 times the second entry in the uptime pseudo-file.
- 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
- The number of interrupts received from the system boot.
- disk_io: (2,0):(31,30,5764,1,2) (3,0):...
- (major,minor):(noinfo, read_io_ops, blks_read, write_io_ops, blks_written)
- 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.
- /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 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
- This directory may contain files with application binary information. On some systems, it is not present.
- /proc/sys/debug
- This directory may be empty.
- /proc/sys/dev
- This directory contains device specific information (eg dev/cdrom/info). On some systems, it may be empty.
- /proc/sys/fs
- This contains the subdirectory binfmt_misc 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 super-max and super-nr with function fairly clear from the name.
- /proc/sys/fs/binfmt_misc
- Documentation for files in this directory can in the kernel sources in Documentation/binfmt_misc.txt.
- /proc/sys/fs/dentry-state
- This 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 seems to be 0 all the time. nr_unused seems to be the number of unused dentries. age_limit is the age in seconds after which dcache entries can be reclaimed when memory is short and want_pages is nonzero 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 quotas 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/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
- This (read-only) file gives the number of files presently opened. It contains three numbers: The number of allocated file handles, the number of free file handles and the maximum number of file handles. The kernel allocates file handles dynamically, but it doesn't free them again. If the number of allocated files is close to the
maximum, you should consider increasing the maximum. When the number of free file handles is large, you've encountered a peak in your usage of file handles and you probably don't need to increase the maximum.
- /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 pageful at a time. nr_free_inodes represents the number of free inodes. preshrink is nonzero when the nr_inodes > inode-max and the system needs to prune the inode list instead of allocating more.
- /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 signal to that process notifying it that another process is waiting to open the file. If the lease holder does not remove or downgrade 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/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 filesystems only support 16-bit UIDs and GIDs, although in Linux UIDs and GIDs are 32 bits. When one of these filesystems 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/super-max
- This file controls the maximum number of superblocks, and thus the maximum number of mounted filesystems the kernel can have. You only need to increase super-max if you need to mount more filesystems than the current value in super-max allows you to.
- /proc/sys/fs/super-nr
- This file contains the number of filesystems currently mounted.
- /proc/sys/kernel
- This directory contains files acct, cad_pid, cap-bound, core_pattern, core_uses_pid, ctrl-alt-del, dentry-state, domainname, hotplug, hostname, htab-reclaim (PowerPC only), java-appletviewer (binfmt_java, obsolete), java-interpreter (binfmt_java, obsolete), l2cr (PowerPC only), modprobe, msgmax, msgmnb, msgmni, osrelease, ostype, overflowgid, overflowuid, panic, panic_on_oops, pid_max, powersave-nap (PowerPC only), printk, pty, random, real-root-dev, reboot-cmd (SPARC only), rtsig-max, rtsig-nr, sem, sg-big-buff, shmall, shmmax, shmmni, sysrq, tainted, threads-max, version and zero-paged (PowerPC only) with function fairly clear from the name.
- /proc/sys/kernel/acct
- This file contains three numbers: highwater, lowwater and frequency. If BSD-style process accounting is enabled these values control its behaviour. If free space on filesystem 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% of space is free; resume it if >= 4% of space is free; consider information about amount of free space valid for 30 seconds.
- /proc/sys/kernel/cap-bound
- 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 exec.
- /proc/sys/kernel/core_pattern
- This file (new in Linux 2.5) provides finer control over the form of a core filename than the obsolete /proc/sys/kernel/core_uses_pid file described below. The name for a core file is controlled by defining a template in /proc/sys/kernel/core_pattern. The template can contain % specifiers which are substituted by the following values when a core file is created:
%% A single % character %p PID of dumped process %u real UID of dumped process %g real GID of dumped process %s number of signal causing dump %t time of dump (secs since 0:00h, 1 Jan 1970) %h hostname (same as the 'nodename' returned by uname(2)) %e executable filename
A single % at the end of the template is dropped from the core filename, as is the combination of a % followed by any character other than those listed above. All other characters in the template become a literal part of the core filename. The maximum size of the resulting core filename is 64 bytes. The default value in this file is "core". For backward compatibility, if /proc/sys/kernel/core_pattern does not include "%p" and /proc/sys/kernel/core_uses_pid is non-zero, then .PID will be appended to the core filename. - /proc/sys/kernel/core_uses_pid
- This file can be used control the naming of a core dump file on Linux 2.4. If this file contains the value 0, then a core dump file is simply named core. If this file contains a non-zero value, then the core dump file includes the process ID in a name of the form core.PID.
- /proc/sys/kernel/ctrl-alt-del
- This file controls the handling of Ctrl-Alt-Del from the keyboard. When the value in this file is 0, Ctrl-Alt-Del is trapped and sent to the init(1) program to handle a graceful restart. When the value is > 0, Linux's reaction to a Vulcan Nerve Pinch (tm) will be an immediate reboot, without 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/hotplug
- This file contains the path for the hotplug policy agent. The default value in this file "/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 and hostname, i.e.:
# 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 hostname "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 PowerPC htab (see kernel file Documentation/powerpc/ppc_htab.txt) is pruned each time the system hits the idle loop.
- /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 nonzero.
- /proc/sys/kernel/modprobe
- This file is described by the kernel source file Documentation/kmod.txt.
- /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 message 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 paramter used to initialise the msg_qbytes setting for subsequenly 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
- gives read/write access to the kernel variable panic_timeout. If this is zero, the kernel will loop on a panic; if nonzero it indicates that the kernel should autoreboot after this number of seconds. When you use the software watchdog device driver, the recommended setting is 60.
- /proc/sys/kernel/panic_on_oops
- This file (new in Linux 2.5) controls the kernel's behaviour 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
- This file (new in Linux 2.5) 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. The value in this file 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_message_loglevel, minimum_console_level and default_console_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 console_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 currently in use.
- /proc/sys/kernel/random This directory contains various parameters controlling the operation of the file /dev/random.
- /proc/sys/kernel/real-root-dev
- This file is documented in the kernel source file Documentation/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
- This file can be used to tune the maximum number of POSIX realtime (queued) signals that can be outstanding in the system.
- /proc/sys/kernel/rtsig-nr
- This file shows the number POSIX realtime 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 on 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/version
- contains a string like:
#5 Wed Feb 25 21:49:24 MET 1998.TP
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/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.
- /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/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. ipc(5) provides further background on the information shown by these files.
- /proc/tty
- Subdirectory containing the psuedo-files and subdirectories for tty drivers and line disciplines.
- /proc/uptime
- This file contains two numbers: the uptime of the system (seconds), and the amount of time spent in idle process (seconds).
- /proc/version
- This string identifies the kernel version that is currently running. It includes the contents of /proc/sys/ostype, /proc/sys/osrelease and /proc/sys/version. For example:
Linux version 1.0.9 (quinlan@phaze) #1 Sat May 14 01:51:54 EDT 1994
SEE ALSO
cat(1), find(1), free(1), mount(1), ps(1), tr(1), uptime(1), chroot(2), mmap(2), readlink(2), syslog(2), slabinfo(5), hier(7), arp(8), dmesg(8), hdparm(8), ifconfig(8), lsmod(8), lspci(8), netstat(8), procinfo(8), route(8), /usr/src/linux/Documentation/filesystems/proc.txt