Recursively find disk usage, sort, and make human readable (for systems without human-readable sort command)

du -x ${SYMLINKS} -k "$@" | sort -n | tail -100 | awk 'BEGIN { logx = log(1024); size[0]= "KB"; size[1]= "MB"; size[2]= "GB"; size[3]= "TB" } { x = $1; $1 = ""; v = int(log(x)/logx); printf ("%8.3f %s\t%s\n",x/(1024^v), size[v], $0) }'
Recursively find disk usage, sort, and make human readable: * For systems without human-readable sort command * awk, not perl
Sample Output
   3.148 MB	 ./arch/cris/include
   3.426 MB	 ./arch/cris
   3.539 MB	 ./arch/blackfin
   4.539 MB	 ./arch/mips/include/asm
   4.543 MB	 ./arch/mips/include
   5.398 MB	 ./arch/mips
   9.543 MB	 ./drivers
  11.230 MB	 ./arch/arm
  13.852 MB	 ./include/linux
  21.820 MB	 ./include
  46.758 MB	 ./arch
  84.902 MB	 .

1
By: dpanofsky
2015-08-27 23:16:25

What Others Think

I love visiting sites in my free time. I have visited many sites but did not find any site more efficient than yours. Thanks for the nudge! ???????
KayGasaway · 14 weeks and 1 day ago
Personally, I have found that to remain probably the most fascinating topics when it draws a parallel to. You may find two to three new levels inside L . a . Weight loss and any one someone is incredibly important. Initial stage may be real melting away rrn the body. lose weight https://gamebnat.net/mtsite10/
KayGasaway · 14 weeks ago
I am unable to read articles online very often, but I’m glad I did today. This is very well written and your points are well-expressed. Please, don’t ever stop writing. ????
KayGasaway · 13 weeks and 5 days ago
Great post, you have pointed out some excellent points, I as well believe this is a very superb website. https://first-11.net/
KayGasaway · 13 weeks and 2 days ago
Thanks for the tips guys. They were all great. I have been having issues with being fat both mentally and physically. Thanks to you guys i have been showing improvements. Do post more. mieszkania wloclawek
KayGasaway · 11 weeks and 3 days ago
great that i found this forum. People here are great. Learned alot. Keep posting more https://boudoirphotographysanjose.com
Killersmile · 5 weeks and 6 days ago
I think this is one of the most significant information for me. And i’m glad reading your article. But should remark on some general things, Outdoor Gym San Diego
KayGasaway · 1 day ago
You guardians do an astounding web diary, and have some unfathomable substance. Continue doing extraordinary. Content creator
KayGasaway · 1 day ago
I think this is definitely an amazing project here. So much good will be coming from this project. The ideas and the work behind this will pay off so much. text marketing
KayGasaway · 7 hours ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: