View the port status in netstat in CentOS
When using Linux, you need to know which ports are open in the current system, and check the specific processes and users that open these ports. You can use the netstat command to perform a simple query.
Parameters of the netstat command are described as follows:
-T: indicates that the TCP port is displayed.
-U: indicates that the UDP port is displayed.
-L: display only the listening socket (the so-called socket is the program that enables the application to read and write and send and receive communication protocols (Protocols) and data)
-P: displays the process identifier and program name. Each socket/port belongs to a program.
-N: No DNS round-robin is performed, and the IP address is displayed (the operation can be accelerated)
All the ports and process services on the current server are displayed. You can use grep to view a specific port and service status:
Netstat-ntlp // view all current tcp ports-netstat-ntulp | grep 80 // view all port 80 usage-netstat-an | grep 3306 // view all port 3306 usage ·
View the usage of all current tcp ports:
For example, to check whether the current MySQL Default port 80 is enabled, perform the following operations: