@don_crissti's first Answer is good, but can be even shorter using [Here Strings][1], e.g. $ numfmt --to=iec-i <<< "12345" 13Ki $ numfmt --to=iec-i --suffix=B <<< "1234567" 1.2MiB or even $ numfmt --from=iec-i --to=iec-i --suffix=B <<< "12345Ki" 13MiB if `<<<` is not available you can use e.g. $ echo "1234567" | numfmt --to=iec-i --suffix=B 1.2MiB [1]: https://stackoverflow.com/a/4775845/5477197