shell瞎记录

cat access_log | awk '{print $1}' | sort |uniq -c|head -n 10

禁止登录失败2次以上的ip访问

#!/bin/bash
cat /var/log/secure |grep "Failed password" |awk '{print $(NF-3)}'|sort |uniq -c|while read a b
do
    grep "$b" /etc/hosts.deny
    if [ $? != 0 ];then
        if [ $a -ge 2 ];then
            echo "sshd: $b" >> /etc/hosts.deny
        fi
    fi
done

df  | grep dc| awk {'print $2'} |  awk '{sum+=$1}END{print sum}'

原文地址:https://www.cnblogs.com/tiantianhappy/p/13099032.html