Treesize in Linux Command Console
I love the program treesize on windows and I was looking for a script to do the same on linux.
Thanks to Andrew who made this neat script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#/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; } ' |
1 2 |
Visit his page on: <a href="http://blog.aclarke.eu/a-simple-treesize-shell-script-for-linux/" rel="nofollow" target="_blank">Andrew's BLog</a> |
admin on January 31st 2012 in Linux