找到系统中最大的文件
1. 最大的文件夹
du / | sort -rn | head
( it will certainly cost you a large amount of time if your filesystem is big)
the options of "sort" are "r" and "n" not "m"
it will help you to find out the ten larget files in /
of course you can replace "/" with any directories you like!
2.最大的文件
du -a | sort -rn | head
du -a write counts for all files, not just directories
3.
#!/bin/bash
path=/tmp/test/
file=`find $path -type f -exec stat -c "%s %n" {} \;|sort -nr|head -3 | awk -F ' ' '{print $2}'`
rm -f $file
阅读(2216) | 评论(0) | 转发(1) |