-
-
Save peterklipfel/df238b79e3a85917372713bec5c408d7 to your computer and use it in GitHub Desktop.
Script to sort disk usage output by size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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