sqldump

(coffee) => code

List All Folders in Descending Order of Size

Fancy du trick to list all folders in the current folder in descending order of size of content with human readable folder-sizes.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
du -k -d 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;
     }
    ''