Home  >  Article  >  Operation and Maintenance  >  How to test whether a port is open in CentOS

How to test whether a port is open in CentOS

angryTom
angryTomOriginal
2020-03-20 17:10:046415browse

How to test whether a port is open in CentOS

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!

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