查看某一个进程的进程数量
1 2 3 4 5 6 | 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 |
pstree 查看进程数
不带任何参数时 可以显示系统中所有用户的进程数结构
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | [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 用户名 以及命令 信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | [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 wenjianbao 查看某个用户使用的进程数结构信息
1 2 3 4 5 | # pstree -ap wenjianbao bash ,4077 └─vim,4097 1.php |