【整理】ps命令输出字段的含义
Linux中的ps命令,用于查看进程状态信息。
其输出内容有很多列,每一列中又有很多字母或符号表示很多种不同意思。
先贴个例子:
MTLG>ps
PID Uid VSZ Stat Command
1 root 132 S /sbin/init
2 root RWN [ksoftirqd/0]
3 root SW
4 root SW
5 root SW
6 root SW
7 root SW [pdflush]
8 root SW [pdflush]
9 root SW
10 root SW
11 root SW [mtdblockd]
12 root SW
13 root SW
14 root DW
15 root SWN [jffs2_gcd_mtd3]
22 root 396 S /bin/sh /root/focus.profile
23 root 32 S /bin/watchdogd -f -k 1 -w 5
30 root SW
50 root 11606 S /root/focusapp
51 root 11606 S /root/focusapp
52 root 11606 S /root/focusapp
143 root 11606 S /root/focusapp
144 root 384 S sh -c ps < /dev/silabstty0 > /dev/silabstty0 2>&1
145 root 516 R ps
具体含义为:
字 段 含义
USER 进程所有者的用户名
PID 进程号
%CPU 进程自最近一次刷新以来所占用的CPU时间和总时间的百分比
%MEM 进程使用内存的百分比
VSZ 进程使用的虚拟内存大小,以K为单位
RSS 驻留空间的大小。显示当前常驻内存的程序的K字节数。
TTY 进程相关的终端
STAT 进程状态,用下面的代码中的一个给出:D不可中断Uninterruptible sleep (usually IO)R正在运行,或在队列中的进程S处于休眠状态T停止或被追踪Z僵尸进程W进入内存交换(从内核2.6开始无效)X死掉的进程
TIME 进程使用的总CPU时间
COMMAND 被执行的命令行
NI 进程的优先级值,较小的数字意味着占用较少的CPU时间
PRI 进程优先级。
PPID 父进程ID
WCHAN 进程等待的内核事件名
其中关于状态信息的英文解释:
PROCESS STATE CODESHere are the different values that the s, stat and state output specifiers
(header “STAT” or “S”) will display to describe the state of a process.
D Uninterruptible sleep (usually IO)
R Running or runnable (on run queue)
S Interruptible sleep (waiting for an event to complete)
T Stopped, either by a job control signal or because it is being traced.
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z Defunct (“zombie”) process, terminated but not reaped by its parent.
For BSD formats and when the stat keyword is used, additional characters may
be displayed:
N low-priority (nice to other users)
L has pages locked into memory (for real-time and custom IO)
s is a session leader
l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
+ is in the foreground process group
【引用】
2.man ps