Man page - numfmt(1)
Packages contas this manual
- timeout(1)
- ls(1)
- uname(1)
- runcon(1)
- nohup(1)
- dir(1)
- hostid(1)
- paste(1)
- sum(1)
- who(1)
- join(1)
- factor(1)
- touch(1)
- chown(1)
- md5sum(1)
- nl(1)
- mkdir(1)
- tac(1)
- false(1)
- stat(1)
- chmod(1)
- sha224sum(1)
- mktemp(1)
- readlink(1)
- seq(1)
- echo(1)
- comm(1)
- tsort(1)
- mkfifo(1)
- unexpand(1)
- cp(1)
- sha256sum(1)
- shred(1)
- tee(1)
- uniq(1)
- expr(1)
- sha384sum(1)
- basenc(1)
- ptx(1)
- fmt(1)
- chcon(1)
- wc(1)
- realpath(1)
- mv(1)
- sha512sum(1)
- yes(1)
- vdir(1)
- printf(1)
- b2sum(1)
- mknod(1)
- tail(1)
- chroot(8)
- tr(1)
- [(1)
- od(1)
- cut(1)
- date(1)
- cat(1)
- du(1)
- pr(1)
- fold(1)
- dirname(1)
- sha1sum(1)
- printenv(1)
- numfmt(1)
- nproc(1)
- chgrp(1)
- sync(1)
- ln(1)
- pwd(1)
- install(1)
- base64(1)
- test(1)
- true(1)
- cksum(1)
- tty(1)
- rmdir(1)
- expand(1)
- link(1)
- df(1)
- stty(1)
- dd(1)
- split(1)
- truncate(1)
- dircolors(1)
- head(1)
- shuf(1)
- id(1)
- basename(1)
- users(1)
- base32(1)
- nice(1)
- sort(1)
- sleep(1)
- unlink(1)
- logname(1)
- whoami(1)
- pathchk(1)
- rm(1)
- csplit(1)
- groups(1)
- stdbuf(1)
- arch(1)
- env(1)
- pinky(1)
apt-get install coreutils
Available languages:
en fr es pl vi nb nl da tr sv ja ro sr deManual
| NUMFMT(1) | User Commands | NUMFMT(1) |
NAME
numfmt - Convert numbers from/to human-readable strings
SYNOPSIS
numfmt [OPTION]... [NUMBER]...
DESCRIPTION
Reformat NUMBER(s), or the numbers from standard input if none are specified.
Mandatory arguments to long options are mandatory for short options too.
- --debug
- print warnings about invalid input
- -d, --delimiter=X
- use X instead of whitespace for field delimiter
- --field=FIELDS
- replace the numbers in these input fields (default=1); see FIELDS below
- --format=FORMAT
- use printf style floating-point FORMAT; see FORMAT below for details
- --from=UNIT
- auto-scale input numbers to UNITs; default is 'none'; see UNIT below
- --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 (which means it has no effect in the C/POSIX locale)
- --header[=N]
- print (without converting) the first N header lines; N defaults to 1 if not specified
- --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 optional SUFFIX 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 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 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 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.
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.
REPORTING BUGS
GNU coreutils online help:
<https://www.gnu.org/software/coreutils/>
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 Debian (9.7-3)
Copyright © 2025 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.
| June 2025 | GNU coreutils 9.7 |