Quantcast
Channel: A standard tool to convert a byte-count into human KiB MiB etc; like du, ls1 - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 21

Answer by Chris for A standard tool to convert a byte-count into human KiB MiB etc; like du, ls1

$
0
0
user@host:/usr$ alias duh="du -s -B1 * | sort -g | numfmt --to=iec-i --format='%10f'"
user@host:/usr$ duh

Gives:

 4.0Ki games
 3.9Mi local
  18Mi include
  20Mi sbin
 145Mi bin
 215Mi share
 325Mi src
 538Mi lib

Unfortunately I can't figure out how to get two decimals accuracy. Tested on Ubuntu 14.04.


Viewing all articles
Browse latest Browse all 21

Trending Articles