#for PROC in /proc/*; do pfiles $PROC |grep "sockname:" | grep "port:"; if [ $? -eq 0 ]; then echo ===========The ports above opened by proc $PROC==========; fi; done
输出结果如下:
sockname: AF_INET 0.0.0.0 port: 3181
sockname: AF_INET 0.0.0.0 port: 3181
sockname: AF_INET 127.0.0.1 port: 32774
===========The ports above opened by proc /proc/1058==========
sockname: AF_INET 0.0.0.0 port: 8161
sockname: AF_INET 0.0.0.0 port: 199
sockname: AF_INET 218.202.128.134 port: 32773
sockname: AF_INET 218.202.128.134 port: 199
sockname: AF_INET 127.0.0.1 port: 199
===========The ports above opened by proc /proc/1069==========
sockname: AF_INET6 ::ffff:218.202.128.134 port: 22
===========The ports above opened by proc /proc/15951==========
sockname: AF_INET6 ::ffff:218.202.128.134 port: 22
===========The ports above opened by proc /proc/15952==========
sockname: AF_INET6 :: port: 21
===========The ports above opened by proc /proc/386==========
sockname: AF_INET6 :: port: 22
===========The ports above opened by proc /proc/429==========
sockname: AF_INET 0.0.0.0 port: 16161
sockname: AF_INET 0.0.0.0 port: 32768
sockname: AF_INET 0.0.0.0 port: 32769
===========The ports above opened by proc /proc/436==========
sockname: AF_INET 0.0.0.0 port: 1221
sockname: AF_INET 0.0.0.0 port: 1221
===========The ports above opened by proc /proc/449==========
sockname: AF_INET 0.0.0.0 port: 34571
sockname: AF_INET 0.0.0.0 port: 34571
sockname: AF_INET 0.0.0.0 port: 34573
sockname: AF_INET 0.0.0.0 port: 34572
sockname: AF_INET 0.0.0.0 port: 0
===========The ports above opened by proc /proc/450==========
然后用 #ps -ef |grep '进程号'
就可以获得 进程名。
阅读(1522) | 评论(0) | 转发(0) |