统计连接到主机前十的ip地址和连接数
常用脚本–tcp
- #!/bin/bash
- #
- #********************************************************************
- #encoding -*-utf8-*-
- #Author: zhangshang
- #Date: 2017-11-25
- #URL: http://blog.vservices.top/myblog
- #Description: The test script
- #Copyright (C): 2017 All rights reserved
- #QQ Numbers: 765030447
- #********************************************************************
- echo -e "\033[31m**************************net_tcp_top_10*********************************\033[0m"
- echo -e "IPADDR\t\tcount"
- ss -nt | grep 'ESTAB' | awk '{print $5}' | cut -d: -f1 | grep "^[[:digit:]]\+.*" | sort | uniq -c | sort -rnk1 | awk '{print $2,"\t",$1}' | head