In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to use the netstat command of Linux". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Linux common command netstat command is used to print the status information of the network system in Linux, so that you can know the network situation of the whole Linux system.
Netstat View Network system status Information in Linux
Syntax netstat (option) option-an or-- all: display Socket;-An or-- in all connections;-c or-- continuous: continuously list the network status;-C or-- cache: display cache information configured by the router;-e or-- extend: display other relevant information about the network;-F or-- fib: display FIB -g or-- groups: displays the list of group members of the multi-broadcast function group;-h or-- help: online help;-I or-- interfaces: displays the form of network interface information;-l or-- listening: displays the Socket;-M or-- masquerade of the server under monitoring: shows the camouflaged network connection;-n or-- numeric: directly uses the ip address, not through the domain name server. -N or-- netlink or-- symbolic: display symbolic connection names of network hardware peripherals;-o or-- timers: display timers;-p or-- programs: display program identifiers and program names that are using Socket;-r or-- route: display Routing Table;-s or-- statistice: display statistical tables of network operation information;-t or-- tcp: display the connection status of the TCP transport protocol -u or-- udp: displays the connection status of the UDP transport protocol;-v or-- verbose: displays the instruction execution;-V or-- version: displays the version information;-w or-- raw: displays the connection status of the RAW transport protocol;-x or-- unix: this parameter has the same effect as the specified "- A unix" parameter;-- ip or-- inet: the effect of this parameter is the same as the specified "- An inet" parameter. The instance lists all ports (including listening and unlistening)
Netstat-a # list all ports netstat-at # list all tcp ports netstat-au # list all udp ports list all Sockets in listening state
Netstat-l # shows only listening ports netstat-lt # lists only all listening tcp ports netstat-lu # lists only all listening udp ports netstat-lx # lists only all listening UNIX ports showing statistics for each protocol
Netstat-s displays statistics of all ports netstat-st displays statistics of TCP ports netstat-su displays statistics of UDP ports ```shell * * displays PID and process name * * ````shell netstat-ptnetstat-p in netstat output and can be used with other switches, you can add "PID/ process name" to netstat output, so that you can easily find the programs running on a specific port when debugging.
Host, port, and user name (host, port or user) are not displayed in the netstat output
When you don't want the host, port and user name to be displayed, use netstat-n. Numbers will be used instead of those names. The output can also be accelerated because there is no need for a comparison query.
If netstat-an simply does not want one of these three names to be displayed, use the following command:
Netsat-a-- numeric-ports netsat-a-- numeric-hosts netsat-a-- numeric-users continuously outputs netstat information
Netstat-c # outputs network information every other second to display the address family that is not supported by the system (Address Families)
Netstat-- verbose will have the following information at the end of the output:
Netstat: no support for `AF IPX' on this system. Netstat: no support for `AF AX25' on this system. Netstat: no support for `AF X25' on this system. Netstat: no support for `AF NETROM' on this system. Display core routing information
Netstat-r uses netstat-rn to display the numeric format without querying the host name.
Find out the port on which the program runs
Not all processes can be found, those without permissions will not be displayed, and use root permissions to view all the information.
Netstat-ap | grep ssh finds the process running on the specified port:
Netstat-an | grep': 80' find process ID through port
Netstat-anp | grep 8081 | grep LISTEN | awk'{printf $7}'| cut-d /-F1 displays the list of network interfaces
Netstat-I displays details, such as ifconfig using netstat-ie.
IP and TCP analysis
Check the IP address with the most connections to a service port:
Netstat-ntu | grep: 80 | awk'{print $5}'| cut-d:-F1 | awk'{+ + ip [$1]} END {for (i in ip) print ip [I], "\ t", I}'| list of sort-nrTCP statuses:
Netstat-nt | grep-e 127.0.0.1-e 0.0.0.0-e::-v | awk'/ ^ tcp/ {+ + state [$NF]} END {for (i in state) print I, "\ t", state [I]} 'check the number of phpcgi processes. If it is close to the preset value, it is not enough and needs to be added:
Netstat-anpo | grep "php-cgi" | wc-l "how to use the netstat command of Linux" ends here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.