Monday, March 01, 2010

LIttle Sugar: Bash :: Finding the N largest or smallest files under a folder

Finding the N largest files under a folder

find . -type f -print|xargs ls -l|sort -r -n -k 5,5 | tail -N

Finding the N smallest files under a folder

find . -type f -print|xargs ls -l|sort -r -n -k 5,5 | head -N

here replace N by the number of largest files you want in the output