View the total number of linux network connections

Source: Internet
Author: User
View the number of connections in various states of the system tcp connection. Netstat-an | awk & amp; #39;/^ tcp/{++ S [$ NF]} END {for (ainS) printa, S [a]} & amp; #39; view all ipnetstat-an connections established with Port 80 of the local machine and in the status of established | grep... view the number of connections in various states of the system tcp connection.

Netstat-an | awk '/^ tcp/{++ S [$ NF]} END {for (a in S) print a, S [a]}'
View all ip addresses that are connected to port 80 of the local machine and are in the status of established


Netstat-an | grep 80 | grep ESTA | awk '{print $5 "\ n"}' | awk 'BEGIN {FS = ": "} {print $1" \ n "} '| sort | uniq
The number of connections of each ip address and the total number of connections in each status are output.


Netstat-n | awk '/^ tcp/{n = split ($ (NF-1), array, ":"); if (n <= 2) ++ S [array [(1)]; else ++ S [array [(4)]; ++ s [$ NF]; ++ N} END {for (a in S) {printf ("%-20 s % s \ n", a, S [a]); + + I} printf ("%-20 s % s \ n", "TOTAL_IP", I); for (a in s) printf ("%-20 s % s \ n", a, s [a]); printf ("%-20 s % s \ n", "TOTAL_LINK ", N );}'
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.