统计连接到主机前十的ip地址和连接数

常用脚本–tcp

  1. #!/bin/bash
  2. #
  3. #********************************************************************
  4. #encoding -*-utf8-*-
  5. #Author: zhangshang
  6. #Date: 2017-11-25
  7. #URL: http://blog.vservices.top/myblog
  8. #Description: The test script
  9. #Copyright (C): 2017 All rights reserved
  10. #QQ Numbers: 765030447
  11. #********************************************************************
  12. echo -e "\033[31m**************************net_tcp_top_10*********************************\033[0m"
  13. echo -e "IPADDR\t\tcount"
  14. ss -nt | grep 'ESTAB' | awk '{print $5}' | cut -d: -f1 | grep "^[[:digit:]]\+.*" | sort | uniq -c | sort -rnk1 | awk '{print $2,"\t",$1}' | head
posted @ 2018-02-28 13:34  莫孟林  阅读(656)  评论(0编辑  收藏  举报