In the process of using Linux, you need to know which ports are currently open in the system, and to check the specific processes and users that open these ports, you can use the netstat command to make a simple query. This article mainly shares Linux with you. How to check the port status, I hope it can help everyone.
The parameters of the netstat command are described as follows:
-t: Specify the TCP port to be displayed
-u: Specify the UDP port to be displayed Port
-l: Display only the listening socket (the so-called socket is a program that enables the application to read, write, and send and receive communication protocols and data)
-p: Display Process identifier and program name, each socket/port belongs to a program.
-n: Do not perform DNS polling, display IP (can speed up the operation)
can display all ports and process services on the current server, and can be combined with grep Check a specific port and service status··
netstat -ntlp //查看当前所有tcp端口· netstat -ntulp |grep 80 //查看所有80端口使用情况· netstat -an | grep 3306 //查看所有3306端口使用情况·
For example, to check whether the current Mysql default port 3306 is started, you can do the following.
Related recommendations:
The above is the detailed content of How to check port status in Linux. For more information, please follow other related articles on the PHP Chinese website!