ps -ef f
用树形显示进程和线程
在Linux下面好像因为没有真正的线程,是用进程模拟的,有一个是辅助线程,所以真正程序开的线程应该只有一个。
ps -ef f |grep httpd
[root@apache dhj]# ps -ef f|grep httpd
root 3756 1 0 Jun09 ? Ss 0:38 /usr/local/apache22/bin/httpd -k start
apache 2146 3756 0 Jun18 ? S 0:00 \_ /usr/local/apache22/bin/httpd -k start
apache 2029 3756 0 15:19 ? Sl 0:06 \_ /usr/local/apache22/bin/httpd -k start
apache 4320 3756 0 15:24 ? Sl 0:01 \_ /usr/local/apache22/bin/httpd -k start
apache 4387 3756 0 15:25 ? Sl 0:01 \_ /usr/local/apache22/bin/httpd -k start
apache 5124 3756 0 15:27 ? Sl 0:01 \_ /usr/local/apache22/bin/httpd -k start
apache 5462 3756 1 15:29 ? Sl 0:04 \_ /usr/local/apache22/bin/httpd -k start
apache 5596 3756 1 15:29 ? Sl 0:03 \_ /usr/local/apache22/bin/httpd -k start
apache 6293 3756 1 15:31 ? Sl 0:00 \_ /usr/local/apache22/bin/httpd -k start
apache 6628 3756 2 15:32 ? Sl 0:00 \_ /usr/local/apache22/bin/httpd -k start
apache 6695 3756 1 15:32 ? Sl 0:00 \_ /usr/local/apache22/bin/httpd -k start
root 6763 28180 0 15:33 pts/1 S+ 0:00 \_ grep
httpd
[root@apache dhj]# ps axm|grep httpd
3756 ? - 0:38 /usr/local/apache22/bin/httpd -k start
2146 ? - 0:00 /usr/local/apache22/bin/httpd -k start
2029 ? - 0:06 /usr/local/apache22/bin/httpd -k start
5124 ? - 0:01 /usr/local/apache22/bin/httpd -k start
5462 ? - 0:08 /usr/local/apache22/bin/httpd -k start
5596 ? - 0:06 /usr/local/apache22/bin/httpd -k start
6293 ? - 0:00 /usr/local/apache22/bin/httpd -k start
7503 ? - 0:01 /usr/local/apache22/bin/httpd -k start
7639 ? - 0:01 /usr/local/apache22/bin/httpd -k start
7908 ? - 0:00 /usr/local/apache22/bin/httpd -k start
7976 pts/1 - 0:00 grep httpd
另外用pstree -c也可以达到相同的效果,但是没有线程号:
[root@apache dhj]# pstree -c|grep httpd
|-httpd-+-cronolog
| |-httpd
| |-httpd
| |-httpd
| |-httpd
| |-httpd
| |-httpd
| |-httpd
| |-httpd
| |-httpd
| |-httpd
| `-httpd
[root@apache dhj]# pstree|grep httpd
|-httpd-+-4*[cronolog]
| `-10*[httpd]
阅读(9441) | 评论(0) | 转发(0) |