Skip to content

Instantly share code, notes, and snippets.

@trinitronx
Created June 4, 2013 21:22
Show Gist options
  • Save trinitronx/5709708 to your computer and use it in GitHub Desktop.
Save trinitronx/5709708 to your computer and use it in GitHub Desktop.
Script to sort disk usage output by size
#!/bin/bash
# This line sorts first according to numerical size in bytes
# the second pass through du in the while loop converts to human readable
# format
du -s * | sort -n | cut -f 2- | while read a; do du -hs "$a"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment