numfmt - Convert numbers from/to human-readable strings


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


   Reformat  NUMBER(s),  or  the  numbers  from standard input if none are

   Mandatory arguments to long options are  mandatory  for  short  options

          print warnings about invalid input

   -d, --delimiter=X
          use X instead of whitespace for field delimiter

          replace the numbers in these input fields (default=1) see FIELDS

          use printf style floating-point FORMAT;  see  FORMAT  below  for

          auto-scale  input  numbers to UNITs; default is 'none'; see UNIT

          specify the input unit size (instead of the default 1)

          use locale-defined grouping of  digits,  e.g.  1,000,000  (which
          means it has no effect in the C/POSIX locale)

          print  (without converting) the first N header lines; N defaults
          to 1 if not specified

          failure mode for invalid numbers: MODE can be: abort  (default),
          fail, warn, ignore

          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

          use METHOD for rounding when scaling; METHOD can be:  up,  down,
          from-zero (default), towards-zero, nearest

          add  SUFFIX  to  output  numbers,  and accept optional SUFFIX in
          input numbers

          auto-scale output numbers to UNITs; see UNIT below

          the output unit size (instead of the default 1)

   -z, --zero-terminated
          line delimiter is NUL, not newline

   --help display this help and exit

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


          $ 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


   Written by Assaf Gordon.


   GNU coreutils online help: <>
   Report numfmt translation bugs to <>


   Copyright    2016  Free Software Foundation, Inc.  License GPLv3+: GNU
   GPL version 3 or later <>.
   This is free software: you are free  to  change  and  redistribute  it.
   There is NO WARRANTY, to the extent permitted by law.


   Full documentation at: <>
   or available locally via: info '(coreutils) numfmt invocation'

More Linux Commands

Mail::SPF::Mech::PTR(3pm) - SPF record "ptr" mechanism class
An object of class Mail::SPF::Mech::PTR represents an SPF record mechanism of type ptr. Constructors The following constructors are provided: new(%options): ret

glLoadMatrixd(3gl) - replace the current matrix with the spe
glLoadMatrix replaces the current matrix with the one whose elements are specified by m. The current matrix is the projection matrix, modelview matrix, or textu

XOMOfOC(3) - create output contexts - Linux manual page.....
The XCreateOC function creates an output context within the specified output method. The base font names argument is mandatory at creation time, and the output

pcre_utf16_to_host_byte_order(3) Perl-compatible regular exp
pcre_utf16_to_host_byte_order.3 - This function, which exists only in the 16-bit library, converts a UTF-16 string to the correct order for the current host, ta

perllol(1) - Manipulating Arrays of Arrays in Perl (ManPage)
Declaration and Access of Arrays of Arrays The simplest two-level data structure to build in Perl is an array of arrays, sometimes casually called a list of lis

XSetDeviceModifierMapping(3) - query or change device modifi
The XSetDeviceModifierMapping request specifies the KeyCodes of the keys (if any) that are to be used as modifiers for the specified device. If it succeeds, the

fdim(3) - positive difference (Library - Linux man page)....
These functions return the positive difference, max(x-y,0), between their arguments. RETURN VALUE On success, these functions return the positive difference. If

XtRemoveInput(3) - register and remove an input source......
The XtAppAddInput function registers with the Intrinsics read routine a new source of events, which is usually file input but can also be file output. Note that

Tcl_GetCurrentNamespace(3) - manipulate namespaces (ManPage)
Namespaces are hierarchic naming contexts that can contain commands and variables. They also maintain a list of patterns that describes what commands are export

acl_get_fd(3) - get an ACL by file descriptor (Man Page)....
The acl_get_fd() function retrieves the access ACL associated with the file referred to by fd. The ACL is placed into working storage and acl_get_fd() returns a

git-ls-remote(1) - List references in a remote repository...
Displays references available in a remote repository along with the associated commit IDs. OPTIONS -h, --heads, -t, --tags Limit to only refs/heads and refs/tag

Tcl_SetCommandInfoFromToken(3) - implement new commands in C
Tcl_CreateObjCommand defines a new command in interp and associates it with procedure proc such that whenever name is invoked as a Tcl command (e.g., via a call

We can't live, work or learn in freedom unless the software we use is free.