ps命令

ps命令是监视系统中进程的主要工具,它可以PIDUID,优先级和控制终端,还可以给出一个进程正在使用多少内存,消耗的CPU时间,当前的状态等信息。

# ps

PID TTY    TIME CMD

2149 pts/1    00:00:00 bash

2202 pts/1    00:00:00 ps

如果有僵进程,显示为<defunct>

ps aux 可以了解正在运行的所有进程的全貌。

[root@netcloud ~]# ps aux

USER    PID %CPU %MEM VSZ RSS TTY   STAT TIME COMMAND

root         1 0.0 0.1   2028   892 ?        Ss   0:01 /sbin/init

root         2 0.0 0.0      0     0 ?       S<   0:00 [kthreadd]

root         3 0.0 0.0      0     0 ?        S<   0:00 [migration/0]

root         4 0.0 0.0      0     0 ?        S<   0:00 [ksoftirqd/0]

root         5 0.0 0.0      0     0 ?        S<   0:00 [watchdog/0]

root         6 0.0 0.0      0     0 ?        R<   0:00 [events/0]

……

root        23 0.0 0.0      0     0 ?        S    0:00 [pdflush]

root        24 0.0 0.0      0     0 ?        S<   0:00 [kswapd0]

root        25 0.0 0.0      0     0 ?        SN   0:00 [ksmd]

……

root       329 0.0 0.1   2660 1008 ?        S<s 0:00 /sbin/udevd -d

……

root       791 0.0 0.1 13320   768 ?        S<sl 0:00 /sbin/audispd

root       792 0.0 0.2 14600 1528 ?        S<   0:00 /usr/sbin/sedispatch

root       816 0.0 0.2 35680 1468 ?        Sl   0:00 /sbin/rsyslogd -c 4

rpc        836 0.0 0.1   2412   720 ?        Ss   0:00 rpcbind

dbus       927 0.0 0.2 13356 1252 ?        Ssl 0:00 dbus-daemon --system

……

root      1304 0.0 0.0   1868   444 tty4     Ss+ 0:00 /sbin/mingetty tty4

root      1305 0.0 0.0   1868   444 tty5     Ss+ 0:00 /sbin/mingetty tty5

……

root      2149 0.0 0.3   6576 1600 pts/1    Rs   0:00 -bash

root      2213 1.0 0.1   6272   968 pts/1    R+   0:00 ps aux

ps命令 - cruelchen - 请重启您的计算........

另一组有用的选项laxps lax的输出包括父进程ID(PPID),谦让值(NI),以及正在等待的资源(WCHAN)

[root@netcloud ~]# ps lax

F   UID   PID PPID PRI NI    VSZ   RSS WCHAN STAT TTY        TIME COMMAND

4     0     1     0 20   0   2028   892 poll_s Ss   ?          0:01 /sbin/init

1     0     2     0 15 -5      0     0 kthrea S<   ?          0:00 [kthreadd]

1     0     3     2 -100 -      0     0 migrat S<   ?          0:00 [migration/0]

1     0     4     2 15 -5      0     0 ksofti S<   ?          0:00 [ksoftirqd/0]

5     0     5     2 -100 -      0     0 watchd S<   ?          0:00 [watchdog/0]

1     0     6     2 15 -5      0     0 worker S<   ?          0:00 [events/0]

1     0     7     2 15 -5      0     0 worker S<   ?          0:00 [cpuset]

……

1     0    21     2 20   0      0     0 watchd S    ?          0:00 [khungtaskd]

……

5     0   329     1 16 -4   2660 1008 poll_s S<s ?          0:00 /sbin/udevd -d

……

5     0   738   329 18 -2   3448 1896 poll_s S<   ?          0:00 /sbin/udevd -d

5     0   739   329 18 -2   2788 1264 poll_s S<   ?          0:00 /sbin/udevd -d

5     0   789     1 16 -4 12784   792 epoll_ S<sl ?          0:00 auditd

4     0   791   789 12 -8 13320   768 futex_ S<sl ?          0:00 /sbin/audispd





linux下ps命令显示含义

 
man了一下 ps和top 解释如下  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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值