Linux-based netstat command introduction the Netstat command is used to display various network-related information, such as network connection, route table, interface status (InterfaceStatistics), masquerade connection, and multicast member (MulticastMemberships. Execute nets for the output information... 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 servers with Listen (Listener? MB? /Div>-p: the program name that establishes the relevant link-r: The route information is displayed, and 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] # 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 *: * 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 localhost: ipp *: * LISTEN tcp6 0 0 localhost: ip P [:]: * 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 Ad Dress 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] [root @ localhost ~] # Netstat-pan | grep 8019 unix 2 [ACC] stream listening 8019 4765/acpid/var/run/acpid. socket
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.