Hacker News new | past | comments | ask | show | jobs | submit login

Not here :( What version of sort are you running?



It can also be achieved with some Perl:

    du -h | perl -e 'sub h{%h=(K=>10,M=>20,G=>30);($n,$u)=shift=~/([0-9.]+)(\D)/; return $n*2**$h{$u}}print sort{h($b)<=>h($a)}<>;'
Source: http://serverfault.com/a/62422/76878


Probably a recent version of GNU sort. AFAIK "sort -h" dates at least as far back as the version shipped with Debian old-stable.


I'm on macOS 10.12.3, GNU coreutils 5.93, and sort doesn't support the "-h" flag.


You're using a version of coreutils from over a decade ago.

  coreutils-5.93.tar.bz2	2005-11-06 09:06


set BLOCKSIZE to some power of 1024 when running du




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: