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]

Loading

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

  • Upgrade RockyLinux 8 to 9
  • Terraform and segregated permissions
  • LVM Compression and Deduplication
  • Edit gpg encrypted file with vim
  • Lelit Elizabeth PL92T Pressure Tuning
  • aws (8)
  • coffee (1)
  • headfi (1)
  • linux (6)
  • others (59)
  • security (2)
  • tech (36)
  • wordpress (2)

Loading

apache apigateway aws awscli azure backup cloud coffee docker ec2 EL8 ElasticBeanstalk enpass espresso featured kernel lelit linux lvm meltdown MFA nat gateway nginx php proliant python rdp Redhat RHEL rpm Ryzen s2s scp serverless site-to-site smartarray snapshot spectre tech terraform transit gateway ubuntu ubuntu upgrade vpn wordpress

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