Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux统计链接数命令集合 #1

Open
bieberHe opened this issue Mar 11, 2016 · 2 comments
Open

Linux统计链接数命令集合 #1

bieberHe opened this issue Mar 11, 2016 · 2 comments

Comments

@bieberHe
Copy link

Linux统计链接数命令集合

@bigbomb
Copy link

bigbomb commented Mar 11, 2016

netstat -nat|grep -i "80"|wc -l

@ShawnShoper
Copy link

查看系统tcp连接中各个状态的连接数。
netstat -an | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

——————
2、查看和本机23端口建立连接并状态在established的所有ip
netstat -an |grep 23 |grep ESTA |awk '{print$5 "\n"}' |awk 'BEGIN {FS=":"} {print $1 "\n"}' |sort |uniq

———————

输出每个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);}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants