Step 1 lsof -i
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, as shown below.
Step 2 lsof -i: port number
Lsof -i: port number, which is used to check the occupancy of a certain port, for example, the usage of port 22, lsof -i:22, as shown in the following figure.
netstat -tunlp
Netstat -tunlp is used to display the ports and processes of tcp and udp, as shown in the following figure.
Step 4 netstat -tunlp|grep port number
The netstat -tunlp|grep port number is used to view the progress of the specified port number, such as viewing the situation of 22 ports, netstat -tunlp|grep 22,