How to check port status in Linux

  1. In the process of using Linux, you need to know which ports are opened by the current system, and to view the specific processes and users who open these ports, you can simply query through the netstat command.
  2. 2

    The parameters of the netstat command are described as follows:

      -t : specify to display the TCP port

      -u : specify to display the UDP port

      -l : Display only listening sockets (the so-called sockets are programs that enable applications 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 operation)

  3. 3

    You can display all ports and process services on the current server. Combine with grep to view a specific port and service status.

    netstat -ntlp //View all current tcp ports ·

    netstat -ntulp |grep 80 //View all 80 port usage ·

    netstat -an | grep 3306 //View all 3306 port usage ·

    1. 4
    2. For example, to check whether the current Mysql default port 3306 is enabled, you can do the following:
     

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326324234&siteId=291194637