最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【整理】ps命令输出字段的含义

工作和技术 crifan 8933浏览 0评论

【整理】ps命令输出字段的含义

Linux中的ps命令,用于查看进程状态信息。

其输出内容有很多列,每一列中又有很多字母或符号表示很多种不同意思。

 

先贴个例子:

MTLG>ps
  PID  Uid        VSZ  Stat     Command
    1 root        132    S         /sbin/init
    2 root                  RWN   [ksoftirqd/0]
    3 root                  SW<    [events/0]
    4 root                  SW<    [khelper]
    5 root                  SW<    [kthread]
    6 root                  SW<    [kblockd/0]
    7 root                  SW     [pdflush]
    8 root                  SW     [pdflush]
    9 root                  SW<   [kswapd0]
   10 root                  SW<  [aio/0]
   11 root                  SW    [mtdblockd]
   12 root                  SW<  [bfin-spi-master]
   13 root                  SW<  [rd_silabs_wq]
   14 root                  DW<  [wr_silabs_wq]
   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<  [IR_State_Machin]
   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            进程状态,用下面的代码中的一个给出: 
                       不可中断     Uninterruptible sleep (usually IO)
                       正在运行,或在队列中的进程
                       处于休眠状态
                       停止或被追踪
                       僵尸进程
                       进入内存交换(从内核2.6开始无效)
                       死掉的进程
                       高优先级
                       低优先级
                       有些页被锁进内存
                       包含子进程
                       位于后台的进程组;
                       多线程,克隆线程

TIME            进程使用的总CPU时间

COMMAND  被执行的命令行

NI                 进程的优先级值,较小的数字意味着占用较少的CPU时间

PRI               进程优先级。

PPID             父进程ID

WCHAN        进程等待的内核事件名

 

其中关于状态信息的英文解释:

PROCESS STATE CODES
Here 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:
<    high-priority (not nice to other users)
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

 

【引用】

1.ps命令输出字段的含义
http://blog.sina.com.cn/s/blog_5dc960cd0100ccoe.html

2.man ps

http://unixhelp.ed.ac.uk/CGI/man-cgi?ps

转载请注明:在路上 » 【整理】ps命令输出字段的含义

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
79 queries in 0.165 seconds, using 22.13MB memory