Disk Space Cleanup

From Psygen Wiki
Revision as of 04:35, 24 March 2017 by Admin (talk | contribs) (Created page with " Find files that are using more than 1GB of space:<br /> <code>du -h / | grep ^[0-9\.]*G > diskusage; cat diskusage</code> More options:<br /> <code>function disk-space { d...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Find files that are using more than 1GB of space:
du -h / | grep ^[0-9\.]*G > diskusage; cat diskusage


More options:
function disk-space { du -sk ./* | sort -nr | awk 'BEGIN{ pref[1]="K"; pref[2]="M"; pref[3]="G"; pref[4]="T";} { total = total + $1; x = $1; y = 1; while( x > 1024 ) { x = (x + 1023)/1024; y++; } printf("%g%s\t%s\n",int(x*10)/10,pref[y],$2); } END { y = 1; while( total > 1024 ) { total = (total + 1023)/1024; y++; } printf("Total: %g%s\n",int(total*10)/10,pref[y]); }' }

disk - (tab complete)