Home >Operation and Maintenance >Linux Operation and Maintenance >How to check which process a port is occupied in Linux

How to check which process a port is occupied in Linux

WBOY
WBOYOriginal
2022-01-04 15:44:5545645browse

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".

How to check which process a port is occupied in Linux

#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

How to check which process a port is occupied in Linux

netstat -tunlp is used to display tcp, udp ports and processes and other related situations, as shown below

How to check which process a port is occupied in Linux

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

How to check which process a port is occupied in Linux

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn