netstat 判断来访的IP


挑选出已经建立的连接的IP,并统计各IP的连接数:

netstat -na|grep ESTABLISHED|awk '{print $5}'| awk -F: '{print $1}'|sort|uniq -c| sort -r +0n

netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",state[key]}'

netstat -anlp|grep 80|grep tcp|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -n20


ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
阅读量: 1002
发布于:
修改于: