Preface to learn a command in Linux, run the netstat command to display network-related information, such as network connection, route table, interface status (interface statistics), and masquerade connection, multicast members (multicase memberships. Netstat information: the output result of netstat is as follows:
- One is to activate an Internet connection, called an active TCP connection. "Recv-Q" and "Send-Q" indicate the receiving queue and the sending queue. These numbers are generally 0. If not, the package is accumulating in the queue. This can only be seen in rare cases.
- The other is an active UNIX domain socket called an active Unix domain socket interface (same as a network socket, but only used for local communication, and the performance can be doubled ). Proto: displays the protocol used for the connection. RefCnt: indicates the process number connecting to the current set of interfaces. Types: displays the current status of the set of interfaces. Path: the path name used by other processes connected to the set interface.
Common parameters-a (all) show all options. LISTEN is not displayed by default.
-T (tcp) only displays tcp-related options
-U (udp) only displays udp-related options
-N: aliases are not displayed. All digits can be converted to digits.
-L only lists the service statuses that have been listened to by Listen.
-P: the program name for establishing the relevant link
-R: displays route information and route tables.
-E: Display extension information, such as uid.
-S: statistics by Protocol
-C runs the netstat command at every fixed time.
Tip: The LISTEN and LISTENING statuses can only be seen with-a or-l. list all tcp ports (including listening and not listening) 2. list all tcp ports in the listener status. 3. display the statistics of all ports 4. displays the pidnetstat-p of the process that occupies a specific tcp port. It can be used with other switches to add the "PID/process name" to the netstat output, in this way, you can easily find programs running on specific ports.