Home > Article > Operation and Maintenance > How to check which process a port is occupied in Linux
Method: 1. Use the lsof command to view. When the command parameter is set to "-i", it is used to display the process status that meets the conditions. The syntax is "lsof -i:port number"; 2. Use the netstat command. View, this command will list all status connections of the port, the syntax is "netstat-tunlp|grep port number".
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
How to check which process a port is occupied in Linux
lsof -i: port number, used to check the occupancy of a certain port, such as Check the usage of port 22, lsof -i:22, as shown below
netstat -tunlp is used to display tcp, udp ports and processes and other related situations, as shown below
netstat -tunlp|grep port number, used to check the process status of the specified port number, such as checking the status of port 22, netstat -tunlp|grep 22, as shown below
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to check which process a port is occupied in Linux. For more information, please follow other related articles on the PHP Chinese website!