NUMFMT(1)

โœจ NUMFMT ๐Ÿ’… the number glow-up machine โœจ

okay bestie, so this is numfmt, and she lives in the User Commands part of the manual (section 1). If you've ever stared at 1048576 and thought "girl, what is that in vibes" โ€” this is the page for you. ๐Ÿซถ


๐ŸŽ€ NAME ๐ŸŽ€

numfmt โ€” Convert numbers from/to human-readable strings


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

numfmt [OPTION]... [NUMBER]...

๐ŸŒธ DESCRIPTION ๐ŸŒธ

Reformat NUMBER(s) โ€” or, if you didn't hand her any numbers, the numbers coming in from standard input. She'll take them and give them the glow-up. โœจ

Mandatory arguments to long options are mandatory for short options too. (yes bestie, that rule is universal, no exceptions, periodt.)

  • --debug โ€” print warnings about invalid input ๐Ÿ‘€
  • -d, --delimiter=X โ€” use X instead of whitespace for the field delimiter
  • --field=FIELDS โ€” replace the numbers in these input fields (default=1); scroll down to FIELDS for the deets
  • --format=FORMAT โ€” use printf style floating-point FORMAT; see FORMAT below for the deets
  • --from=UNIT โ€” auto-scale input numbers to UNITs; default is 'none'; see UNIT below for the deets
  • --from-unit=N โ€” specify the input unit size (instead of the default 1)
  • --grouping โ€” use locale-defined grouping of digits, e.g. 1,000,000. lowkey important: this has no effect in the C/POSIX locale ๐Ÿฅฒ
  • --header[=N] โ€” print (without converting) the first N header lines; N defaults to 1 if you don't specify it
  • --invalid=MODE โ€” failure mode for invalid numbers; MODE can be: abort (default), fail, warn, ignore
  • --padding=N โ€” pad the output to N characters; positive N will right-align, negative N will left-align; padding is ignored if the output is wider than N; the default is to automatically pad if a whitespace is found
  • --round=METHOD โ€” use METHOD for rounding when scaling; METHOD can be: up, down, from-zero (default), towards-zero, nearest
  • --suffix=SUFFIX โ€” add SUFFIX to output numbers, and accept an optional SUFFIX in input numbers
  • --unit-separator=SEP โ€” insert SEP between number and unit on output, and accept an optional SEP in input numbers
  • --to=UNIT โ€” auto-scale output numbers to UNITs; see UNIT below
  • --to-unit=N โ€” the output unit size (instead of the default 1)
  • -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; suffixes will trigger an error ๐Ÿšจ
  • auto โ€” accept optional single/two letter suffix: 1K = 1000, 1k = 1000, 1Ki = 1024, 1M = 1000000, 1Mi = 1048576,
  • si โ€” accept optional single letter suffix: 1k = 1000, 1K = 1000, 1M = 1000000, ...
  • iec โ€” accept optional single letter suffix: 1K = 1024, 1k = 1024, 1M = 1048576, ...
  • iec-i โ€” accept optional two-letter suffix: 1Ki = 1024, 1ki = 1024, 1Mi = 1048576, ...

๐Ÿงš FIELDS ๐Ÿงš

okay so FIELDS supports cut(1) style field ranges, and honestly? iconic behaviour:

  • 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.


๐Ÿ’€ exit status, bestie ๐Ÿ’€

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.
not her being forgiving in warn and ignore mode ๐Ÿ˜ญ she really said "no stress, we move on."

๐ŸŒˆ 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. (shoutout ๐Ÿซก)


๐Ÿšจ REPORTING BUGS ๐Ÿšจ

Report bugs to: <bug-coreutils@gnu.org>. Report any translation bugs to: <https://translationproject.org/team/>. GNU coreutils home page: <https://www.gnu.org/software/coreutils/> General help using GNU software: <https://www.gnu.org/gethelp/>


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.

that "NO WARRANTY" is in all caps for a reason bestie, do not come for her if something breaks ๐Ÿ™ˆ

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

Full documentation <https://www.gnu.org/software/coreutils/numfmt> or available locally via: info '(coreutils) numfmt invocation'


and that's the whole page, no cap. this was GNU coreutils 9.12, from September 2026 โ€” she's serving section 1 of the User Commands manual and she ate ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from