Who rated this post

cancel
Showing results for 
Search instead for 
Did you mean: 
Maarten_Sjouw
Champion
Champion

A long time ago I ran into a simple program called treesize which allows you to run it in any directory and will give you a listing of the directories with the amount of KB/MB/GB is used in that directory.

run : vi  /usr/bin/treesize 

and paste this content:

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;
     }
    '

 

Close vi and execute: chmod +x /usr/bin/treesize

Regards, Maarten

View solution in original post

0 Kudos
(1)
Who rated this post