查询linux服务器有哪些IP在连接
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
查看linux的连接数,输出每个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 ", a, S[a]);++I}printf("%-20s %s ","TOTAL_IP",I);for(a in s) printf("%-20s %s ",a, s[a]);printf("%-20s %s ","TOTAL_LINK",N);}'