1、检索access.log日志并按ip访问次数进行排序,显示前10
cat access.log | awk '{print $1}' | sort | uniq -c | sort -rn | head -n 10
2、搜索当前目录下包含指定字段的文件(包括子目录)
find ./ -type f -name "*" |xargs grep "1.4.10.18"
grep -rn 'nikto-test' . --include=* 跟上面类似,不过可以显示具体在哪行
3、只查看配置文件中未被注释的有效配置行
#有空白行 grep -v "^#" denyhosts.conf #无空白行 cat denyhosts.conf | grep "^s*[^# ].*$" sed '/ *#/d; /^ *$/d' denyhosts.conf egrep -v "^#|^$" denyhosts.conf