May 2010 Archives
Tue May 18 10:57:05 EDT 2010
Find the biggest file or folder inside a directory.
By using the `du` command we can find the biggest file or directory inside a folder. The next example shows how to list the 10 most biggest files and floders inside 'HOME'
du -a ~/ | sort -n -r | head -n 10
If we use the `find` command we can list the 10 biggest files inside a directory, even if they are inside sub-folders.
find ~/ -type f -exec ls -ls {} \; | awk '{print $6"\t"$9}' | sort -k1 -n -r | head -n 10