#/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;
}
'
Create this file, save it as "treesize", make it executable and put it in your /bin folder. Then you can go to any directory and type treesize to list the sizes of the files and folders in that directory.
Credit goes to This Blog where I found this handy script.
No comments:
Post a Comment