查看Linux网络连接及连接总数

centos,系统运维 2017-11-06

netstat -an | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

查看系统tcp连接中各个状态的连接数。

netstat -an |grep 80 |grep ESTA |awk '{print$5 "\n"}' |awk 'BEGIN {FS=":"} {print $1 "\n"}'
 |sort |uniq

查看和本机80端口建立连接并状态在established的所有ip

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("%-20s %s\n", a, S[a]);++I}
 printf("%-20s %s\n","TOTAL_IP",I);for(a in s)
printf("%-20s %s\n",a, s[a]);printf("%-20s %s\n","TOTAL_LINK",N);}'

输出每个ip的连接数,以及总的各个状态的连接数


本文由 伯仁 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

12 条评论

  1. essayforme

    Superb tips. Thank you!

  2. levitra generic

    levitra 20mg review forum rules - levitra from canada cheap forum is locked - how does levitra work

  3. cialis over the counter walmart

    cialis 20 mg 12 table registered users - will cialis allow me to get laid with 3 different girl[...]

  4. viagra generic

    viagra bph - order viagra online - viagra risks

  5. cialis generic

    cialis and alcohol - cialis and alcohol side effects yahoo messenger - cialis coupon online no [...]

  6. tadalafil generic

    cialis 10mg or 20mg new posts - cialis uk cheap - cialis dose mg display posts from previous

  7. viagra online

    viagra 10mg cost you cannot edit your posts in this forum - groups viagra uk generic - viagra p[...]

  8. viagra for sale

    viagra kaufen - iwant to buy some viagra - buy generic viagra online

  9. viagra without prescription

    buy brand or generic viagra online lowest price order - viagra 5mg dosage location - diabetes and ed

  10. viagra for sale

    viagra 10mg or 20mg log me on automatically each visit - viagra with alcohol - viagra 5mg moderators

  11. cialis otc

    levitra viagra cialis - cialis 20mg pills usergroups - cialis 5mg cost registered users

  12. cialis 20 mg

    viagra levitra cialis different types - cialis price - cialis from 365 phramacy

添加新评论