NUMFMT(1)
π NUMFMT π
okay bestie, sit down, because numfmt (that's section 1 of the General Commands Manual, if you were wondering) is literally the glow-up your numbers have been begging for π«Ά
β¨ NAME β¨
numfmt β convert numbers from/to human-readable strings. yes. that's the whole vibe. numbers that look like 1048576 get to wear a cute little 1Mi outfit and honestly? iconic.
πΈ SYNOPSIS πΈ
numfmt [OPTION]... [NUMBER]...
π¦ DESCRIPTION π¦
Convert numbers from/to human-readable strings. she does one thing and she eats every single time π
π OPTIONS π
--debugβ print warnings about invalid input. like, she'll tell you when something's giving sus data π--groupingβ use locale-defined grouping of digits, for example1,000,000. heads up though: this means it has no effect in the C/POSIX locale, so if nothing happens, that's why, not you π₯²-d,--delimiter <X>β useXinstead of whitespace for the field delimiter--field <FIELDS>[default:1] β replace the numbers in these input fields; peep FIELDS below for the tea--format <FORMAT>β use printf style floating-pointFORMAT; details are down in FORMAT, don't skip it bestie--from <UNIT>[default:none] β auto-scale input numbers to UNITs; see UNIT below--from-unit <N>[default:1] β specify the input unit size--to <UNIT>[default:none] β auto-scale output numbers to UNITs; see UNIT below--to-unit <N>[default:1] β the output unit size--padding <N>β pad the output toNcharacters; positiveNwill right-align; negativeNwill left-align; padding is ignored if the output is wider thanN; the default is to automatically pad if a whitespace is found--header[=<N>]β print (without converting) the firstNheader lines;Ndefaults to1if not specified--round <METHOD>[default:from-zero] β useMETHODfor rounding when scaling. possible values are:updownfrom-zerotowards-zeronearest
--suffix <SUFFIX>β printSUFFIXafter each formatted number, and accept inputs optionally ending withSUFFIX--unit-separator <STRING>β useSTRINGto separate the number from any unit when printing; by default, no separator is used--invalid <INVALID>[default:abort] β set the failure mode for invalid input. possible values are:abortfailwarnignore
-z,--zero-terminatedβ line delimiter is NUL, not newline-h,--helpβ Print help-V,--versionβ Print version
π EXTRA π
the UNIT options, explained
none: no auto-scaling is done; suffixes will trigger an error π¨auto: accept optional single/two letter suffix:
1K = 1000, 1Ki = 1024, 1M = 1000000, 1Mi = 1048576,
si: accept optional single letter suffix:
1K = 1000, 1M = 1000000, ...
iec: accept optional single letter suffix:
1K = 1024, 1M = 1048576, ...
iec-i: accept optional two-letter suffix:
1Ki = 1024, 1Mi = 1048576, ...
FIELDS (cut-core energy, fr fr)
FIELDS supports cut(1) style field ranges:
N N'th field, counted from 1
N- from N'th field, to end of line
N-M from N'th to M'th field (inclusive)
-M from first to M'th field (inclusive)
- all fields
Multiple fields/ranges can be separated with commas π«
FORMAT
FORMAT must be suitable for printing one floating-point argument %f. Optional quote (%'f) will enable --grouping (if supported by current locale). Optional width value (%10f) will pad output. Optional zero (%010f) width will zero pad the number. Optional negative values (%-10f) will left align. Optional precision (%.1f) will override the input determined precision.
π VERSION π
v(uutils coreutils) 0.12.0
π EXAMPLES π
Convert 1.5K (SI Units) to 1500:
numfmt --from si 1.5K
Convert 1500 to 1.5K (SI Units):
numfmt --to si 1500
Convert 1.5K (IEC Units) to 1536:
numfmt --from iec 1.5K
Use appropriate conversion based on the suffix:
numfmt --from auto 1.5Ki
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|--summarize] * | numfmt --to iec --format "%-5f"
The examples are provided by the tldr-pages project <https://tldr.sh> under the CC BY 4.0 License. Please note that, as uutils is a work in progress, some examples might fail. (not her fault, she's growing π±)
okay that's the whole page, and before you go: this little masterpiece is dated 2026-09-25, so that's the era of numfmt you're living in. go forth and make your numbers pretty, bestie πβ¨πΈ no cap.
π¦ where this page comes from
- ubuntu stonking: rust-coreutils 0.12.0-1ubuntu2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms