Skip to content

Instantly share code, notes, and snippets.

@akheron
Created March 12, 2014 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save akheron/9502209 to your computer and use it in GitHub Desktop.
Save akheron/9502209 to your computer and use it in GitHub Desktop.
du -h sorted by size
# From http://derblub.com/human-readable-and-by-size-sorted-disk-usage-in-bash
function duf {
du -sk "$@" | sort -n | while read size fname; do for unit in k M G T P E Z Y; do if [ $size -lt 1024 ]; then echo -e "${size}${unit}\t${fname}"; break; fi; size=$((size/1024)); done; done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment