[[Email protected] ~]# netstat -n|head -3active internet connections (w/o servers) proto recv-q send-q local address foreign address State tcp 0 52 192.168.1.165:22 192.168.1.10:59337 ESTABLISHED altogether six columns: The first column is the protocol used by the socket. [[email protected] ~]$ netstat -n |awk '/^tcp/ {++s[$NF]} end { for (A in s) print a, s[a]} ' time_wait 9137close_wait 207fin_wait1 547established 597fin_wait2 74syn_recv 70closing 55last_ack 8[[email protected] ~]# man netstat outputactive internet connections (Tcp, udp, raw) ProtoThe protocol (Tcp, udp, raw) used by the socket. The first column is the protocol used by the socket. recv-qthe count of bytes not copied by the user program Connected to this socket. The number of bytes received by the second column but not yet processed. send-qthe count of bytes not acknowledged by the remote Host. The third column is the number of bytes that have been sent but not received by the remote host. Local addressaddress and port number of the local end of the socket. Unless the --numeric (-N) optionisspecified,thesocketaddress is resolved to its canonical host name (FQDN), and the port number is translated into the corresponding service name. IV is the local address and port. Foreign addressaddress and port number of the reMote endofthesocket. Analogousto "Local address." The external address and port are listed in the five. statethestateofthesocket.sincethere are no states in raw mode and Usually nostates used in udp, this column may be left blank. normally this can be one of sev-eral values: Sixth is the state of the socket, usually with only TCP status , the status value may be established,syn_sent,syn_recv fin_wait1,fin_wait2,time_wait and so on, see below. Among them, the most important is the sixth column. established establishedthe socket has an established Connection.socket has established a connection, indicating that it is in a connected state and is generally considered to have a established as a concurrent connection of a service. This connection state is important in the production scenario and should be focused on. Syn_sentthe socket is actively attempting to establish a connection. socket is actively trying to establish a connection, that is, a wait but does not match the status of the connection before the connection is sent. syn_recva connection request has been received from the Network. A connection request has been received from the Web. Fin_wait1the socket is closeThe D, and the connection is shutting down. socket is closed and the connection is or is shutting down. Fin_wait2connectionisclosed,andthesocket is waiting for a shutdown from the remote end. The connection is closed and the socket is waiting for the remote end. time_waitthe socket is waiting after close to handle packets Still in the network.socket is waiting to close a packet that is still on the network, and this connection state is important in the production scenario and should focus on. closed the socket is not being used.| The socket is not occupied. Close_waitthe remote end has shutdown, waiting for the socket to close. The remote has ended, wait for the socket to close. last_ackthe remote end has shut down, and the socket is closed. waiting for acknowl-edgement.| The remote has ended and the socket is closed, waiting for acknowl-edgement. Listen thesocketislisteningforincoming connections. Such sockets are notincluded in the output unless you specify the --listening (-L) or --all (-a) Option.socket is listening for connection requests. Closingboth sockets are shut down but we still don ' t have All our data sent.sockets closed, but we still haven't sent the data. Unknownthe state of the socket is unknown the unknown state.
This article is from the "Randolph" blog, make sure to keep this source http://randolph.blog.51cto.com/10900500/1909072
Linux-netstat Network Connection status information for the output