Menu
blog.headdesk.me
blog.headdesk.me

Convert number to human readable format

Posted on 2015/01/232015/01/23

Sure you can do the math yourself but why not trust a tool. coreutils include a tool called numfmt which can convert a number to human readable format. Much like when you run df -h. On mac homebrew, the tool is called gnumfmt. Give it a try:

[code]
$ gnumfmt –to=iec-i –suffix=B 4812939778547
4.4TiB

$ echo 9.78Ti | gnumfmt –from=iec-i –to=iec
9.8T

$ echo 123.456Pi | gnumfmt –from=iec-i –to-unit=G
129452999
[/code]

facebookShare on Facebook
TwitterTweet

Leave a Reply Cancel reply

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

Full text search

Recent Posts

  • Dumping AWS Organization tree
  • Free is the most expensive
  • Terraform conditional resource and blocks
  • Upgrade Ubuntu 16.04 to latest release
  • Inspect and control network traffic on AWS
  • aws (8)
  • coffee (1)
  • headfi (1)
  • linux (7)
  • others (55)
  • security (2)
  • tech (36)
  • wordpress (2)

apache aws awscli azure backup cloud coffee coreos distributed filesystem docker ec2 EL8 elasticcache etckeeper featured heartbleed kernel linux mail meltdown mysql php pine python rdp rds Redhat Red Hat RHEL RHEL7 rpm Ryzen snapshot spectre SSL systemd tech terraform ubuntu ubuntu upgrade vector vpn wordpress xtreemfs yum

©2022 blog.headdesk.me | Powered by SuperbThemes & WordPress