Current location - Quotes Website - Team slogan - How does linux check whether the port number is used?
How does linux check whether the port number is used?
In the process of using Linux, you need to know which ports are open in the current system. To see the specific processes and users who open these ports, you can make a simple query through the netstat command.

The parameters of the netstat command are described as follows:

-t: indicates that the TCP port is displayed.

-u: indicates that UDP port is displayed.

-l: Only monitor sockets are displayed (sockets are programs that enable applications to read, write, send and receive communication protocols and data).

-p: Displays the process identifier and program name, and each socket/port belongs to a program.

-n: display IP without DNS polling (this will speed up the operation)

You can display all the ports and process services on the current server, and you can view the specific ports and services in combination with grep. ...

Netstat -ntlp // View all current tcp ports.

netstat -ntulp |grep? 80 // View the usage of all 80 ports.

Netstat -an | grep 3306 // View the usage of all 3306 ports.

For example, to check whether the current Mysql default port 3306 is started, you can do the following.