Simple file size sorting
Here it goes, simple file size sorting in OS X and Linux (in kilobytes).
Linux:
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" "
Some recent findings
#/bin/sh du -k --max-depth=1 "$@" | sort -nr | awk ' BEGIN { split("KB,MB,GB,TB", Units, ","); } { u = 1; while ($1 >= 1024) { $1 = $1 / 1024; u += 1 } $1 = sprintf("%.1f %s", $1, Units[u]); print $0; } '
and
du -hs * .??* 2> /dev/null | sort -h | tail -22
and
du -h | sort -h
September 3rd, 2012 in
main entries