(1)统计当前目录下的 *txt 文件
du -c -h *txt (2)统计当前目录下的 *txt 文件, 并求出总大小du *txt |awk 'BEGIN{count=0;size=0;} \ {count = count + 1; size = size + $1/1024;} \ END{print "Total count " count; \ print "Total size " size/1024 " GB" ; \ print "Avg size " size / count "MB"}' (3)统计当前目录下及其子目录中的 +1000000k 文件find . -size +1000000k -exec ls -l {} \; |awk 'BEGIN{count=0;size=0;} \ {count = count + 1; size = size + $5/1024/1024;} \ END{print "Total count " count; \ print "Total Size " size/1024 " GB" ; \ print "Avg Size " size / count "MB"; \ print "—"}'(4)统计当前目录下及其子目录中的 *.fastqfind . -name '*.fastq' -exec ls -l {} \; |awk 'BEGIN{count=0;size=0;} \ {count = count + 1; size = size + $5/1024/1024;} \ END{print "Total count " count; \ print "Total Size " size/1024 " GB" ; \ print "Avg Size " size / count "MB"; \ print "—"}' (5)统计当前目录下及其子目录中的之前2天的文件find . -mtime -2 -exec ls -l {} \; |awk 'BEGIN{count=0;size=0;} \ {count = count + 1; size = size + $5/1024/1024;} \ END{print "Total count " count; \ print "Total Size " size/1024 " GB" ; \ print "Avg Size " size / count "MB"; \ print "—"}'