Function: Print the status information of network system in Linux, know the network condition of Linux system
Options:
-A
shows all sockets in the connection
-a lists the relevant addresses in the network type line-
C continuously lists the network status -
C display router configuration's cache information -
E Display network Other related information -
G display multi-group list -
L Display monitor server socket -
n Direct use IP address, not through the domain name server -
n Display symbolic link names for network hardware peripherals-
p displays the program ID and program name of the socket you are using -
t Displays the connection status of the TCP transport protocol -
u shows the connection status of the UDP transport protocol -
x--unix
Instance:
* List all ports (including listening and not listening)
netstat-a List all ports
netstat-at List all TCP ports
netstat-au List all UDP ports
* List all sockets out of listening status
Netstat-l only monitor ports are displayed
netstat-lt list only all listening TCP ports
netstat-lu lists only all UDP ports that are listening
NETSTAT-LX only lists all listening Unix ports
* Show statistics for each protocol
netstat-s displaying statistics for all ports
netstat-st displaying statistics for TCP ports
Netstat-su displaying statistics for UDP ports
* PID and process names are displayed in the Netstat output
netstat-pt
* hosts, ports and usernames (host, port or user) are not displayed in the Netstat output
Netstat-an
netstat-a--numeric-ports/hosts/users
* Continuous output netstat information
netstat-c #每一秒输出网络信息
* Display of address families not supported by the system (addr families)
netstat--verbose
netstat:no support for ' AF IPX ' on the This system.
netstat:no support for ' AF AX25 ' on the This system.
netstat:no support for ' AF X25 ' on the This system.
netstat:no support for ' AF Netrom ' on the This system.
* Show Core routing information
netstat-r/Route-n
* Display Network interface list
netstat-i
Iface MTU Met rx-ok rx-err rx-drp rx-ovr tx-ok tx-err tx-drp tx-ovr FLG
eth0 0 412469225 0 0 0 374093441 0 0 0 Bmru
Lo 16436 0 1417 0 0 0 1417 0 0 0 LRU
netstat-ie/ifconfig-a
*ip and TCP analysis view the IP addresses that link the most ports on a server
Netstat-ntu | grep:80 | awk ' {print $} ' | cut-d:-f1 | awk ' {++ip[$1]} END {for (i-in IP) print ip[i], "\ t", i} ' | so Rt-nr
4 172.16.5.177
4 172.16.5.143
3 172.20.44.23
2 172.16.5.163
2 172.16.5.140
2 172.16.210.133
1 172.20.99.2
*tcp various status lists
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", St Ate[i]} '
time_wait 4
close_wait 1
established
* View the number of phpcgi processes, if close to the preset value, the description is not enough.
Netstat-anpo | grep "php-cgi" |wc-l (Root view)
Netstat-anpo | grep "UNIX" |wc-l
-
Netstat command explanation