常用Linux Tips(不定期更新)

查看本机所有开放端口

lsof -i -P | grep -i listen

查看一段文本单词出现频率

awk '{b[length($0)]++;total_lines++;for(i=1;i<=NF;i++){sub(/^\W+|\W+$/,"",$i);a[$i]++;total_words++}} END{print "Top 10 words frequency:";for(i in a)printf "%s %.2f%%(%d/%d)\n",i,100*a[i]/total_words,a[i],total_words| "sort -nr -k2 | head -10"}' i

某时间文件

find / -type f |xargs ls -l --full-time 2>/dev/null | awk '{print$6,$9}'|grep 11-17

find排除某文件夹

-not 

find / -type f -not \( -name 'mnt' \) -user cms | tee cms_file1.txt

find / -ctime -20 \( -path /proc -o -path /mnt \) -prune -type f | xargs ls -la | tee findit.txt

检查NAS服务器连接信息

showmount -e xxxxxx
posted @ 2016-08-01 09:49  tdifg  阅读(235)  评论(0编辑  收藏  举报