Skip to content

Instantly share code, notes, and snippets.

@simonid
Last active January 1, 2018 12:13
Show Gist options
  • Save simonid/d6731cd1c461bbd05be6261e4c59c552 to your computer and use it in GitHub Desktop.
Save simonid/d6731cd1c461bbd05be6261e4c59c552 to your computer and use it in GitHub Desktop.
Linux实用命令

Linux实用命令

统计一个目录下所有指定格式文件的大小总和

du -csh *.pdf
# 注意,在这里开头会输出所有指定格式的单个文件的大小,

生成一个指定大小的文件

dd if=/dev/zero of=50M.file bs=1M count=50
#生成一个50M

查看目录下大于指定容量的文件名及数量

ls -l | awk 'BEGIN{i=0} {if($5>40*1024*1024){filename[i++]=$9;}} END{print "total:"i;for(j=0;j<i;j++){print "filename:"filename[j];}}'
# 查看大于大于40M的
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment