How to test whether the port is open in CentOS
To test whether the local port is open in CentOS, you can use the netstat command.
Recommended learning: CentOS usage tutorial
The parameters of the netstat command are described as follows:
-a: All
-t: Specifies the TCP port to be displayed
-u: Specifies the UDP port to be displayed
-l: Only displays the listening socket (the so-called socket enables the application to read, write and send and receive communications Protocol and data program)
-p: Displays the process identifier and program name. Each socket/port belongs to a program.
-n: Do not perform DNS polling, display IP (can speed up operation)
For example, to test whether port 80 is open, you can use
netstat -ntulp |grep 80 #
and then For example, check the 3306 port
netstat -an | grep 3306 //查看所有3306端口使用情况
PHP Chinese website, a large number of website construction tutorials, welcome to learn!
The above is the detailed content of How to test whether a port is open in CentOS. For more information, please follow other related articles on the PHP Chinese website!