numfmt command examples

numfmt command examples

numfmt – Convert numbers from/to human-readable strings

$ 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 | numfmt --header --field 2 --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

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *