Skip to content

Instantly share code, notes, and snippets.

@yeetim
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save yeetim/b1ffdb0cf0cb5c1bf33a to your computer and use it in GitHub Desktop.

Select an option

Save yeetim/b1ffdb0cf0cb5c1bf33a to your computer and use it in GitHub Desktop.

Revisions

  1. yeetim revised this gist Oct 23, 2014. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion cmd
    Original file line number Diff line number Diff line change
    @@ -14,5 +14,8 @@ netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",st

    #查看连接某服务端口最多的的IP地址
    netstat -nat | grep "ip:port" |awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -20
    #
    netstat -nat |awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -20
    #mysql add user
    grant all[权限] on 数据库.* to 用户名@登录主机 identified by ''

    netstat -nat |awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -20
  2. yeetim revised this gist Oct 23, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion cmd
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,6 @@ netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",st
    #LAST_ACK: 等待所有分组死掉

    #查看连接某服务端口最多的的IP地址
    netstat -nat | grep "ip:port" |awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -20
    netstat -nat | grep "ip:port" |awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -20

    netstat -nat |awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -20
  3. yeetim revised this gist Sep 26, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions cmd
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    #查看当前TCP链接状态
    netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",state[key]}'
    #CLOSED: 无连接是活动的或正在进行
    #LISTEN: 服务器在等待进入呼叫
    @@ -11,4 +12,5 @@ netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",st
    #TIME_WAIT: 另一边已初始化一个释放
    #LAST_ACK: 等待所有分组死掉

    #查看连接某服务端口最多的的IP地址
    netstat -nat | grep "ip:port" |awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -20
  4. yeetim revised this gist Sep 26, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion cmd
    Original file line number Diff line number Diff line change
    @@ -9,4 +9,6 @@ netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",st
    #ITMED_WAIT: 等待所有分组死掉
    #CLOSING: 两边同时尝试关闭
    #TIME_WAIT: 另一边已初始化一个释放
    #LAST_ACK: 等待所有分组死掉
    #LAST_ACK: 等待所有分组死掉

    netstat -nat | grep "ip:port" |awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -20
  5. yeetim created this gist Sep 26, 2014.
    12 changes: 12 additions & 0 deletions cmd
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",state[key]}'
    #CLOSED: 无连接是活动的或正在进行
    #LISTEN: 服务器在等待进入呼叫
    #SYN_RECV: 一个连接请求已经到达,等待确认
    #SYN_SENT: 应用已经开始,打开一个连接
    #ESTABLISHED:正常数据传输状态
    #FIN_WAIT1: 应用说它已经完成
    #FIN_WAIT2: 另一边已同意释放
    #ITMED_WAIT: 等待所有分组死掉
    #CLOSING: 两边同时尝试关闭
    #TIME_WAIT: 另一边已初始化一个释放
    #LAST_ACK: 等待所有分组死掉