How much bytes is in Linux 1K, 1M or 1G
Matthew Barrera
Is 1K in Linux 1024 bytes or 1000 bytes ? Or in other words is K one kilobyte (KB) or kibibyte (KiB)?
Does that factor hold for the other units as well like if it 1024 then 1M = 1024K and 1G = 1024M ?
22 Answers
It depends on which tools you're using and which APIs.
Historically it wasn't uncommon to use KB to mean 1024. While in fact the SI-Prefix Kilo indicates 1000. So you will find programs that use KB and mean KiB, you will find programs that use KB and mean KB.
This is further complicated if you have multiple tools interact with each other. You will have to evaluate it individually. There is no single truth for this.
Just as an example have a look at the UnitsPolicy on the Ubuntu Wiki.
1Yes, 1024 KiB kibibyte KB kilobyte = 1 Mb 1024 MiB mebibyte MB megabyte = 1 Gb 1024 GiB gibibyte GB gigabyte = 1 Tb.
1