To view the number of connections

Source: Internet
Author: User

# Netstat-an | awk '/^tcp/{++s[$NF]} END {for (a in S) print A, s[a]} '
Time_wait 22387
Close_wait 11
Syn_sent 1
Fin_wait1 1
Established 423
LISTEN 73

# Netstat-n | awk '/^tcp/{++s[$NF]} END {for (a in S) print A, s[a]} '
Time_wait 21394
Close_wait 16
Fin_wait1 1
Established 423

==========================

# netstat-n|grep "^tcp" |awk ' {print $NF} ' |sort-n|uniq-c|sort-n
Close_wait
423 established
22670 time_wait

# netstat-an|grep "^tcp" |awk ' {print $NF} ' |sort-n|uniq-c|sort-n
1 fin_wait1
Close_wait
LISTEN
421 established
20296 time_wait

difference: The above two differences are Netstat-an and Netstat-n where a represents the full state, including the current port listening state,-n only represents the current connection state.

Parameter description:
CLOSED: No connection is active or in progress
LISTEN: The server is waiting to enter the call
SYN_RECV: A connection request has arrived, waiting for confirmation
Syn_sent: Application has started, open a connection
Established: Normal data transfer status
FIN_WAIT1: Application says it's done
Fin_wait2: The other side has agreed to release
Itmed_wait: Waiting for all packets to die
CLOSING: Both sides try to close simultaneously
Time_wait: The other side has initialized a release
Last_ack: Waiting for all packets to die

To view the number of connections

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.