numfmt

Convert numbers to and from human-readable strings.

Install

All systems
curl cmd.cat/numfmt.sh
Debian Debian
apt-get install coreutils
Ubuntu
apt-get install coreutils
Alpine
apk add coreutils
Arch Arch Linux
pacman -S coreutils
image/svg+xml Kali Linux
apt-get install coreutils
CentOS
yum install coreutils
Fedora
dnf install coreutils
OS X
brew install coreutils
Raspbian
apt-get install coreutils
Docker
docker run cmd.cat/numfmt numfmt powered by Commando

Convert numbers to and from human-readable strings.

  • Convert 1.5K (SI Units) to 1500:
    numfmt --from=si 1.5K
  • Convert 5th field (1-indexed) to IEC Units without converting header:
    ls -l | numfmt --header=1 --field=5 --to=iec
  • Convert to IEC units, pad with 5 characters, left aligned:
    du -s * | numfmt --to=iec --format="%-5f"

© tl;dr; authors and contributors