I am a professional DevOps Engineer with a demonstrated history of working in the internet industry. I am an avid Linux lover and supporter of the open-source movement philosophy.
Location
Sofia, Bulgaria
Work
Developer Advocate at Materialize | Community Manager at DigitalOcean | Co-Founder at DevDojo
Use this expanded command to get a better view of sorted file sizes:
root@server# du -sk ./* | sort -nr | awk 'BEGIN{ pref[1]="K"; pref[2]="M"; pref[3]="G";} { 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]); }'
6.3G ./lib
2.1G ./share
320.8M ./src
246.9M ./bin
41.2M ./sbin
29.9M ./include
17.4M ./libexec
6.5M ./local
24K ./games
4K ./libx32
4K ./lib64
4K ./lib32
Total: 8.1G
This is a super nice one-liner! Bookmarked!
Thanks man :D
This is sick!
used it since like 2009 when I needed to seperate a large folder containing thousands of file :)