使用 netstat 进行查看!
>netstat -noap | grep 80 | grep tcp
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
-----------------------------------------------------------------------------------------------------------------
tcp 74160 138880 127.0.0.1:6150 127.0.0.1:6150 ESTABLISHED 3145/tnslsnr unkn-4 (52.04/0/0)
tcp 0 0 :::8009 :::* LISTEN 31550/java off (0.00/0/0)
tcp 0 0 :::8080 :::* LISTEN 31550/java off (0.00/0/0)
tcp 0 0 :::80 :::* LISTEN 24675/httpd off (0.00/0/0)
…
使用 lsof 进行查看!
谁在使用tcp8080端口
>/usr/sbin/lsof -i tcp:8080
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
------------------------------------------------------
java 31550 root 109u IPv6 78687600 TCP *:webcache (LISTEN)
谁在使用22端口
>/usr/sbin/lsof -i :22
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
sshd 2883 root 3u IPv6 7642 TCP *:ssh (LISTEN) >/usr/sbin/lsof -i | grep http
uselib24 15272 apache 4u IPv6 217212 TCP *:http (LISTEN) uselib24 15272 apache 6u IPv6 217217 TCP *:https (LISTEN)