Linux Command To Sort du -h By File Size A quick command to sort du -h by file size using 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)}<>;’ Output will be like so 4.6M . 3.8M ./folder1…
Programming, Security and Tech (and Code Snippets)