Only to find a successful way, not to find excuses for failure!
分类: LINUX
2011-04-14 13:47:33
查内部IP连接数:
netstat -ant |sed -e 's/::ffff://g'|awk '{print $4}'|sort|uniq -c|sort -rn |head
查外部IP连接数:
netstat -ant |sed -e 's/::ffff://g'|awk '{print $5}'|awk -F: '{print $1}'|sort |uniq -c|sort -nr |head
连起来:(粘到命令行直接回车)
clear;echo "Internal:";netstat -ant |sed -e 's/::ffff://g'|awk '{print $4}'|sort|uniq -c|sort -rn |head;echo "External:"; netstat -ant |sed -e 's/::ffff://g'|awk '{print $5}'|awk -F: '{print $1}'|sort |uniq -c|sort -nr |head