Linux :netstat
-t tcp三次握手
-u udp直传数据
-l 监听
-r 路由
-n 显示ip端口号
-p 进程
一般的我们使用 netstat -tnpl | grep xxx 配合管道符来查找
[root@VM_48_173_centos conf]# netstat -tnpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 127.0.0.1:6800 0.0.0.0:* LISTEN 3569/java
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 2856/nginx: master
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2856/nginx: master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1015/sshd
tcp 0 0 127.0.0.1:8087 0.0.0.0:* LISTEN 30812/sshd: root@pt
tcp 0 0 127.0.0.1:6600 0.0.0.0:* LISTEN 3523/java
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 26445/svnserve
tcp6 0 0 :::111 :::* LISTEN 32611/rpcbind
tcp6 0 0 :::80 :::* LISTEN 2856/nginx: master
tcp6 0 0 :::8088 :::* LISTEN 3569/java
Windows :netstat
通常使用netstat -aon | findstr ‘xxxx’ 注意单引号