Linux-based netstat command Introduction The Netstat command is used to display various network-related information, such as network connection, route table, Interface status (Interface Statistics), masquerade connection, and Multicast member (Multicast Memberships. Output Information meaning after netstat is executed, the output result is [plain] [root @ localhost ~] # Netstat Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State getnameinfo failed tcp 0 132 [UNKNOWN]: ssh [UNKNOWN]: 3101 ESTABLISHED Active UNIX domain sockets (w/o servers) proto RefCnt Flags Type State I-Node Path unix 9 [] DGRAM 7700/dev/log unix 2 [] DGRAM 8754 @/var/run/hal/hotplug_socket unix 2 [] DGRAM 5079 @ udevd unix 2 [] DGRAM 43227 unix 3 [] stream connected 12811/var/run/secrets/system_bus_socket unix 3 [] stream connected 12810 unix 3 [] stream connected 8749/var/run/secrets/system_bus_socket unix 3 [] stream connected 8748 unix 3 [] stream connected 8742/var/run/secrets/system_bus_socket unix 3 [] stream connected 8741 unix 3 [] stream connected 8618 unix 3 [] STREAM CONNECTED 8617 unix 2 [] DGRAM 8494 uni X 2 [] DGRAM 8429 unix 2 [] DGRAM 8414 unix 2 [] DGRAM 8387 unix 2 [] DGRAM 8268 unix 3 [] stream connected 7890 unix 3 [] stream connected 7889 unix 2 [] DGRAM 7780 unix 2 [] DGRAM 7708 overall, the output result of netstat can be divided into two parts: Active Internet connections, called Active TCP connection, "Recv-Q" and "Send-Q" indicate that % 0A is a receiving queue and a 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 Active UNIX domain sockets, called the Active Unix domain interface (which is the same as network socket, but can only be 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 this interface. Types indicates the type of the interface set. State indicates the current status of the interface set, path indicates the Path name used by other processes connected to the set interface. Common parameters-a (all) show all options. By default, LISTEN-t (tcp) is not displayed. Only tcp-related options-u (udp) are displayed) only show udp-related options-n decline display alias, can show all the numbers into numbers. -L only list the service status in the Listen (listener).-p: the program name that establishes the relevant link.-r: The route information is displayed. Route table-e: the extended information is displayed, for example, uid and other-s are counted according to each 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 ports (including listener and unlistened ports) list all ports netstat-a [plain] # netstat-a | more Active Internet connections (servers and established) proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 localhost: 30037 *: * LISTEN udp 0 0 *: bootpc *: * Active UNIX domain sockets (servers and established) proto RefCnt Flags Type State I-Node Path unix 2 [ACC] STREAM LISTENING 6135/tmp /. x11-unix/X0 unix 2 [ACC] stream listening 5140/var/run/acpid. socket lists all tcp ports netstat-at [plain] # netstat-at Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 localhost: 30037 *: * LISTEN tcp 0 0 localhost: ipp *: * LISTEN tcp 0 0 *: smtp *: * LISTEN tcp6 0 0 localhost: ipp [:]: * LISTEN lists all udp ports. netstat-au [plain] <Span style = "font-size: 12px;"> # netstat-au Active Internet connections (servers and established) proto Recv-Q Send-Q Local Address Foreign Address State udp 0 0 *: bootpc *: * udp 0 0 *: 49119 *: * udp 0 0 *: mdns *: * </span> 2. list all Sockets in the listening status. only the listening port netstat-l [plain] # netstat-l Active Internet connections (only servers) is displayed) proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 localhos T: ipp *: * LISTEN tcp6 0 localhost: ipp [:]: * LISTEN udp 0 0 *: 49119 *: * only list all listening tcp ports netstat-lt [plain] # netstat-lt Active Internet connections (only servers) proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 localhost: 30037 *: * LISTEN tcp 0 0 *: smtp *: * LISTEN tcp6 0 0 localhost: ipp [: :]: * LISTEN only lists all listening udp ports. netstat-lu [plain] # netstat-lu Active Internet connections (only Servers) Proto Recv-Q Send-Q Local Address Foreign Address State udp 0 0 *: 49119 *: * udp 0 0 *: mdns *: * 3. check which process occupies the port to list the port process usage. netstat-pan | grep 8019 [plain] <span style = "font-size: 12px;"> [root @ localhost ~] # Netstat-pan | grep 8019 unix 2 [ACC] stream listening 8019 4765/acpid/var/run/acpid. socket </span>