天天看點

LINUX 檢視端口

學習日志

使用 netstat -nlt 檢視端口使用情況

[root@appsvr /]# netstat -nlt

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State     

tcp        0      0 127.0.0.1:7200              0.0.0.0:*                   LISTEN     

tcp        0      0 0.0.0.0:7777                0.0.0.0:*                   LISTEN     

tcp        0      0 0.0.0.0:7778                0.0.0.0:*                   LISTEN     

tcp        0      0 0.0.0.0:1830                0.0.0.0:*                   LISTEN     

tcp        0      0 0.0.0.0:33675               0.0.0.0:*                   LISTEN     

tcp        0      0 0.0.0.0:651                 0.0.0.0:*                   LISTEN     

tcp        0      0 23.36.2.161:7148            0.0.0.0:*                   LISTEN     

tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN     

tcp        0      0 127.0.0.1:12401             0.0.0.0:*                   LISTEN     

tcp        0      0 23.36.2.161:12401           0.0.0.0:*                   LISTEN     

tcp        0      0 23.36.2.161:7121            0.0.0.0:*                   LISTEN     

tcp        0      0 0.0.0.0:1810                0.0.0.0:*                   LISTEN     

tcp        0      0 0.0.0.0:6003                0.0.0.0:*                   LISTEN     

tcp        0      0 0.0.0.0:12501               0.0.0.0:*                   LISTEN     

tcp        0      0 127.0.0.1:6101              0.0.0.0:*                   LISTEN     

tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN     

tcp        0      0 0.0.0.0:9400                0.0.0.0:*                   LISTEN     

tcp        0      0 0.0.0.0:6200                0.0.0.0:*                   LISTEN     

tcp        0      0 0.0.0.0:12601               0.0.0.0:*                   LISTEN     

tcp        0      0 0.0.0.0:9401                0.0.0.0:*                   LISTEN     

tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN     

tcp        0      0 0.0.0.0:9402                0.0.0.0:*                   LISTEN     

tcp        0      0 0.0.0.0:1851                0.0.0.0:*                   LISTEN     

tcp        0      0 23.36.2.161:7100            0.0.0.0:*                   LISTEN     

tcp        0      0 :::22                       :::*                        LISTEN     

使用lsof -i  檢視端口屬于哪個程式

[root@appsvr /]# lsof -i :7778

COMMAND     PID   USER   FD   TYPE DEVICE SIZE NODE NAME

httpd     16606 oracle   16u  IPv4  44999       TCP *:7778 (LISTEN)

webcached 16627 oracle   20u  IPv4  89597       TCP appsvr.localdomain:35133->appsvr.localdomain:7778 (CLOSE_WAIT)

webcached 16627 oracle   21u  IPv4  89598       TCP appsvr.localdomain:35134->appsvr.localdomain:7778 (CLOSE_WAIT)

httpd     16641 oracle   16u  IPv4  44999       TCP *:7778 (LISTEN)

httpd     16643 oracle   16u  IPv4  44999       TCP *:7778 (LISTEN)

httpd     16645 oracle   16u  IPv4  44999       TCP *:7778 (LISTEN)

httpd     16646 oracle   16u  IPv4  44999       TCP *:7778 (LISTEN)

httpd     16651 oracle   16u  IPv4  44999       TCP *:7778 (LISTEN)

httpd     16654 oracle   16u  IPv4  44999       TCP *:7778 (LISTEN)

httpd     16657 oracle   16u  IPv4  44999       TCP *:7778 (LISTEN)

httpd     17802 oracle   16u  IPv4  44999       TCP *:7778 (LISTEN)

httpd     20532 oracle   16u  IPv4  44999       TCP *:7778 (LISTEN)

httpd     20910 oracle   16u  IPv4  44999       TCP *:7778 (LISTEN)

httpd     21151 oracle   16u  IPv4  44999       TCP *:7778 (LISTEN)

httpd     21154 oracle   16u  IPv4  44999       TCP *:7778 (LISTEN)

httpd     21155 oracle   16u  IPv4  44999       TCP *:7778 (LISTEN)

繼續閱讀