numfmt
Convert numbers to and from human-readable strings. More information: https://www.gnu.org/software/coreutils/numfmt.
-
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}}"
License and Disclaimer
The content on this page is copyright © 2014—present the tldr-pages team and contributors.This page is used with permission under Creative Commons Attribution 4.0 International License.
While we do attempt to make sure content is accurate, there isn't a warranty of any kind.