netstat 分组统计

统计到本机某个端口的连接,显示IP和连接个数

netstat -n|grep 10.10.55.39:80 | awk '{item=$5;gsub(/::ffff:/,"",item);gsub(/:[0-9]*/,"",item);++S[item]} END {for(ip in S ) print ip,S[ip]}'

其中10.10.55.39:80为主机IP和要统计的端口

猜你喜欢

转载自super-robin.iteye.com/blog/2205071
今日推荐