Lsof -i is used to display qualified processes, and lsof (List Open Files) is a tool to list open files in the current system. Execute the lsof -i command as root.
Step 2 lsof -i: port number
Lsof -i: port number, used to check the occupancy of a port, such as the usage of port 22, lsof -i:2.
netstat -tunlp
Netstat -tunlp is used to display the ports and processes of tcp and udp.
Step 4 netstat -tunlp|grep port number
Netstat -tunlp|grep port number, used to view the progress of the specified port number, such as viewing the situation of 22 ports, netstat -tunlp|grep 22.