查看某一个进程的进程数量:pstree -p 26693 | wc -l
ps -ef | wc -l
ps -ef | grep httpd | wc -l
netstat -ant | grep "ESTABLISHED" | wc -l
ps -e|wc -l
4 pstree 查看进程数
不带任何参数时 可以显示系统中所有用户的进程数结构
[root@www ~]# pstree
init─┬─acpid
├─atd
├─auditd─┬─audispd───{audispd}
│ └─{auditd}
├─automount───4*[{automount}]
├─avahi-daemon───avahi-daemon
├─bonobo-activati───{bonobo-activati}
├─bt-applet
├─clock-applet
├─crond
├─cupsd
├─2*[dbus-daemon]
├─dbus-launch
├─eggcups
├─escd───{escd}
├─events/0
├─gam_server
├─gconfd-2
├─gnome-keyring-d
pstree aup 将列出进程的PID 用户名 以及命令 信息
[root@www ~]# pstree -aup
init,1
├─acpid,3198
├─atd,3544
├─auditd,2467
│ ├─audispd,2469
│ │ └─{audispd},2480
│ └─{auditd},2468
├─automount,3296
│ ├─{automount},3297
│ ├─{automount},3298
│ ├─{automount},3301
│ └─{automount},3304
├─avahi-daemon,3575,avahi
│ └─avahi-daemon,3576
├─gnome-terminal,1884
│ ├─bash,1949
│ ├─bash,2241
│ │ └─su,4076 fjc
│ │ └─bash,4077,fjc
│ │ └─vim,4097 1.php
│ ├─bash,2295
│ │ └─pstree,4366 -aup
│ ├─bash,2494
│ ├─gnome-pty-helpe,1914
│ └─{gnome-terminal},1916
├─gnome-vfs-daemo,3980
├─gpm,3465 -m /dev/input/mice -t exps2
├─hald,3217,haldaemon
│ └─hald-runner,3218,root
│ ├─hald-addon-acpi,3225,haldaemon
│ ├─hald-addon-keyb,3233,haldaemon
│ └─hald-addon-stor,3242
├─hcid,3109
├─hidd,3267 –server
├─hpiod,3318
├─httpd,2087
│ ├─httpd,2119,apache
│ ├─httpd,2120,apache
│ ├─httpd,2121,apache
│ ├─httpd,2122,apache
│ ├─httpd,2123,apache
│ ├─httpd,2124,apache
│ ├─httpd,2125,apache
│ ├─httpd,2126,apache
│ ├─rotatelogs,2115 /home/xiaowang/logs/%Y%m%d%H.error_log 720048
│ ├─rotatelogs,2116 /home/xiaoli/logs/%Y%m%d%H.error_log 7200 480
│ ├─rotatelogs,2117 /home/xiaowang/logs/%Y%m%d%H.access_log 72004
│ └─rotatelogs,2118 /home/xiaoli/logs/%Y%m%d%H.access_log 7200480
查看某个用户使用的进程数结构信息
# pstree -ap fjc
bash,4077
└─vim,4097 1.php
还有许多参数的都可以在man 中一一的查看到