linux 查看端口号对应的进程信息

引用
[hadoop@hhumaster ~]$ lsof -i:22
COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
ssh     6796 hadoop    3u  IPv6  29809      0t0  TCP localhost:56470->localhost:ssh (ESTABLISHED)



[hadoop@hhumaster ~]$ netstat -nlp | grep 9000
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp        0      0 ::ffff:121.248.200.26:9000  :::*                        LISTEN      9302/java
[hadoop@hhumaster ~]$ lsof -i:9000
COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    9302 hadoop   37u  IPv6  39077      0t0  TCP hhumaster:cslistener (LISTEN)
java    9302 hadoop   52u  IPv6  40097      0t0  TCP hhumaster:cslistener->hhudatanode3:36717 (ESTABLISHED)
java    9302 hadoop   53u  IPv6  40430      0t0  TCP hhumaster:cslistener->hhudatanode5:58580 (ESTABLISHED)
java    9302 hadoop   54u  IPv6  40595      0t0  TCP hhumaster:cslistener->hhudatanode2:59142 (ESTABLISHED)
java    9302 hadoop   56u  IPv6  40924      0t0  TCP hhumaster:cslistener->hhudatanode4:41856 (ESTABLISHED)

        -p, --programs             display PID/Program name for sockets
        -c, --continuous           continuous listing
        -l, --listening            display listening server sockets

猜你喜欢

转载自dagu.iteye.com/blog/1299896