numfmt
Convert numbers between plain, SI, and IEC binary unit systems. Parse human-readable size strings back to raw numbers for byte count humanization or input parsing.
Instructions
Convert numbers between plain, SI (K, M, G), and IEC binary (Ki, Mi, Gi) unit systems. Read-only, no side effects. Parses human-readable strings with SI/IEC suffixes back to raw numbers. Returns JSON with the converted value by default; use --raw for plain output. Use to humanize byte counts or parse user-supplied size strings. Not for formatted string output — use 'printf' for general formatting. See also 'printf'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from_unit | No | Input unit system. | none |
| max_lines | No | Maximum JSON records to emit. | |
| numbers | No | Numbers to convert. Defaults to whitespace tokens from stdin. | |
| precision | No | Digits after the decimal point before trimming zeros. | |
| raw | No | Write converted numbers without a JSON envelope. | |
| to_unit | No | Output unit system. | none |