NUMFMT(1)
π NAME π
numfmt β the glow-up your numbers have been waiting for: convert numbers from/to human-readable strings π
β¨
π¦ SYNOPSIS π¦
numfmt [OPTION]... [NUMBER]...
πΈ DESCRIPTION πΈ
Okay so picture this, bestie: numfmt reformats your NUMBER(s) β or, if you didn't hand it any numbers, it takes the numbers from standard input. Either way, it's giving β¨conversion eraβ¨.
Real talk though: mandatory arguments to long options are mandatory for short options too. No sneaking around that one, fr fr. π
--debugβ prints warnings about invalid input π-d,--delimiter=Xβ useXas the field delimiter instead of whitespace--field=FIELDSβ swap out the numbers in these input fields (default is1); peep FIELDS below for the deets--format=FORMATβ use a printf-style floating-pointFORMAT; check FORMAT below for the details--from=UNITβ auto-scale the input numbers to UNITs; default isnone; see UNIT below, iykyk--from-unit=Nβ specify the input unit size (instead of the default1)--groupingβ use locale-defined grouping of digits, like1,000,000. Okay but heads up: this has no effect in the C/POSIX locale π--header[=N]β print (without converting) the firstNheader lines;Ndefaults to1if you don't specify--invalid=MODEβ the failure mode for invalid numbers;MODEcan be:abort(that's the default),fail,warn,ignore--padding=Nβ pad the output toNcharacters; a positiveNwill right-align, a negativeNwill left-align; padding gets ignored if the output is already wider thanN; the default is to automatically pad if a whitespace is found--round=METHODβ useMETHODfor rounding when scaling;METHODcan be:up,down,from-zero(default bestie),towards-zero,nearest--suffix=SUFFIXβ addSUFFIXto the output numbers, and accept an optionalSUFFIXon the input numbers--unit-separator=SEPβ insertSEPbetween the number and the unit on output, and accept an optionalSEPin the input numbers--to=UNITβ auto-scale the output numbers to UNITs; see UNIT below--to-unit=Nβ the output unit size (instead of the default1)-z,--zero-terminatedβ line delimiter is NUL, not newline π«Ά--helpβ display this help and exit--versionβ output version information and exit
π« UNIT options π«
noneβ no auto-scaling is done at all; suffixes will trigger an error πautoβ accept an optional single/two letter suffix:1K= 1000,1k= 1000,1Ki= 1024,1M= 1000000,1Mi= 1048576,siβ accept an optional single letter suffix:1k= 1000,1K= 1000,1M= 1000000, ...iecβ accept an optional single letter suffix:1K= 1024,1k= 1024,1M= 1048576, ...iec-iβ accept an optional two-letter suffix:1Ki= 1024,1ki= 1024,1Mi= 1048576, ...
π FIELDS supports cut(1) style field ranges π
Nβ the N'th field, counted from1N-β from the N'th field, to the end of the lineN-Mβ from the N'th to the M'th field (inclusive)-Mβ from the first to the M'th field (inclusive)-β all fields, every single one, no crumbs left behind
Multiple fields/ranges can be separated with commas, because of course they can π
FORMAT must be suitable for printing one floating-point argument '%f'. The optional quote (%'f) will enable --grouping (if it's supported by your current locale). The optional width value (%10f) will pad the output. The optional zero (%010f) width will zero pad the number. Optional negative values (%-10f) will left align. And the optional precision (%.1f) will override the input determined precision. Slay. π
Exit status is 0 if all input numbers were successfully converted. By default, numfmt will stop at the first conversion error with exit status 2. With --invalid='fail' a warning is printed for each conversion error and the exit status is 2. With --invalid='warn' each conversion error is diagnosed, but the exit status is 0. With --invalid='ignore' conversion errors are not diagnosed and the exit status is 0. Pick your fighter. π₯
π₯ EXAMPLES π₯
$ numfmt --to=si 1000
-> "1.0k"
$ numfmt --to=iec 2048
-> "2.0K"
$ numfmt --to=iec-i 4096
-> "4.0Ki"
$ echo 1K | numfmt --from=si
-> "1000"
$ echo 1K | numfmt --from=iec
-> "1024"
$ df -B1 | numfmt --header --field 2-4 --to=si
$ ls -l | numfmt --header --field 5 --to=iec
$ ls -lh | numfmt --header --field 5 --from=iec --padding=10
$ ls -lh | numfmt --header --field 5 --from=iec --format %10f
π AUTHOR π
Written by Assaf Gordon. Respect the icon, no cap. π
π REPORTING BUGS π
Found something cursed? Tell the devs, bestie:
- Report bugs to:
bug-coreutils@gnu.org - GNU coreutils home page:
https://www.gnu.org/software/coreutils/ - General help using GNU software:
https://www.gnu.org/gethelp/ - Report any translation bugs to:
https://translationproject.org/team/
π SEE ALSO π
- Full documentation:
https://www.gnu.org/software/coreutils/numfmtβ or available locally via:info '(coreutils) numfmt invocation' - Packaged by Ubuntu (
9.10-1ubuntu2) - Copyright Β© 2026 Free Software Foundation, Inc.
- License GPLv3+: GNU GPL version 3 or later
https://gnu.org/licenses/gpl.html. - This is free software: you are free to change and redistribute it.
- There is NO WARRANTY, to the extent permitted by law. π«£
and that's a wrap, bestie!! π this whole vibe check came to you courtesy of GNU coreutils 9.10, dated August 2026, and it's living in the NUMFMT(1) slot of your manual β go convert some numbers and be the main character of your own terminal. πβπ¦
π¦ where this page comes from
- ubuntu stonking: gnu-coreutils 9.10-1ubuntu2 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms