我们可以使用两个命令
[root@jdk tools]# lsof -i:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 5841 root 6u IPv4 22906 0t0 TCP *:http (LISTEN)
nginx 5842 nobody 6u IPv4 22906 0t0 TCP *:http (LISTEN)
[root@jdk tools]# netstat -antp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 5841/nginx
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3407/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1322/master
tcp 0 64 192.168.79.132:22 192.168.79.1:50986 ESTABLISHED 3279/sshd
tcp 0 0 :::22 :::* LISTEN 3407/sshd
tcp 0 0 ::1:25 :::* LISTEN 1322/master