Run the command: netstat-tunlp will display all ports and all corresponding programs. You can use the grep pipeline to filter out the desired keyword segments. For programs occupying port 22: Copy code example: [root @ leiwan tmp] # netstat-tunlp | grep 22tcp 0 0 0.0.0.0: 42957 0.0.0.0: * LISTEN 2230/rpc. statd tcp 0 0 0.0.0.0: 22 0.0.0.0: * LISTEN 2443/sshd tcp 0 0 127.0.0.1: 631 0.0.0.0: * LISTEN 2292/cupsd tcp 0 ::: 22 ::: * LISTEN 2443/sshd tcp 0: 1: 631: * LISTEN 2292/cupsd tcp 0: 57609: * LISTEN 2230/rpc. statd udp 0 0 0.0.0.0: 5353 0.0.0.0: * 2211/avahi-daemon udp 0 0 0.0.0.0: 631 0.0.0.0: * 2292/cupsd udp 0 0 0.0.0.0: 37167 0.0.0.0: * 2230/rpc. statd udp 0 0 0.0.0.0: 52291 0.0.0.0: * 2211/avahi-daemon udp 0 0 0.0.0.0: 68 0.0.0.0: * 2207/dhclient udp 0 0 0.0.0.0: 710 0.0.0.0: * 2230/rpc. statd udp 0 0: 39834: * 2230/rpc. statd: lsof-I: Port Number copy code example: 1 [root @ www ~] # Lsof-I: 213 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME4 pure-ftpd 2651 root 4u IPv4 7047 TCP *: ftp (LISTEN) 5 pure-ftpd 2651 root 5u IPv6 7048 TCP *: ftp (LISTEN) port 21 is being used by pure-ftpd and the status is listen.