Simple file size sorting

Here it goes, simple file size sorting in OS X and Linux (in kilobytes).


du -s -k * | sort -n -k1,1 -t" "

In both OS X and Linux you can alternatively use “-m” for megabytes, and “-g” for gigabytes. In Linux you can additionally fine grain to bytes using “-b”.

If you want to see biggest files at the top, use “-r” parameter for sorting:

du -s -k * | sort -r -n -k1,1 -t" "