NUMFMT(1)

πŸ“¦
version 9.10 Β· 5 versions
, in ubuntu stonking

πŸŽ€ 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 β€” use X as the field delimiter instead of whitespace
  • --field=FIELDS β€” swap out the numbers in these input fields (default is 1); peep FIELDS below for the deets
  • --format=FORMAT β€” use a printf-style floating-point FORMAT; check FORMAT below for the details
  • --from=UNIT β€” auto-scale the input numbers to UNITs; default is none; see UNIT below, iykyk
  • --from-unit=N β€” specify the input unit size (instead of the default 1)
  • --grouping β€” use locale-defined grouping of digits, like 1,000,000. Okay but heads up: 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
  • --invalid=MODE β€” the failure mode for invalid numbers; MODE can be: abort (that's the default), fail, warn, ignore
  • --padding=N β€” pad the output to N characters; a positive N will right-align, a negative N will left-align; padding gets ignored if the output is already 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 bestie), towards-zero, nearest
  • --suffix=SUFFIX β€” add SUFFIX to the output numbers, and accept an optional SUFFIX on the input numbers
  • --unit-separator=SEP β€” insert SEP between the number and the unit on output, and accept an optional SEP in 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 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 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 from 1
  • N- β€” from the N'th field, to the end of the line
  • N-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:


πŸ’œ 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