Created
February 21, 2015 09:31
-
-
Save wh13371/c88cb0ce0b57807aed91 to your computer and use it in GitHub Desktop.
.bashrc "treesize" function
This file contains hidden or 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
treesize(){ | |
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; | |
} | |
' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment