BYTEPREFIX(5)

✨ BYTEPREFIX(5) ✨

okay bestie, so this is the byteprefix page from the File Formats Manual, and it's literally all about how your computer shows sizes πŸ’– buckle up


πŸŽ€ NAME πŸŽ€

byteprefix β€” configuration for display of sizes


🌸 DESCRIPTION 🌸

so there are like, two standard ways to use units in computing, and this is the whole drama:

  • base 10, where 1 k = 10^3 = 1 000
  • base 2, where 1 K = 2^10 = 1 024

historically, most computer programs have used base 2 units, where 1 KB = 1 024 bytes, 1 MB = 1 048 576 bytes, etc. but here's the thing β€” users are way more likely to expect and understand sizes in base 10, because that's literally the norm outside of computing. it's giving "everyone else was doing it right the whole time" 😭

this configuration file is the method for configuring programs (the ones that use libkibi) to display sizes in your preferred style. you can configure it through a configuration file or an environment variable β€” and the environment variable takes precedence, so it's the main character here πŸ’…

when you're not using the "historic" style, IEC-style prefixes (KiB, MiB, etc.) are used for base 2 units, to disambiguate them from base 10 units (kB, MB, etc.). no cap, that disambiguation is the whole point πŸ¦‹


πŸ’… OPTIONS πŸ’…

there are three possible styles. default is base10 ✨

  • base2 β€” display all sizes in Base 2 with IEC prefixes.
1 KiB = 1 024 bytes.
1 MiB = 1 024 KiB = 1 048 576 bytes.
1 GiB = 1 024 MiB = 1 048 576 KiB = 1 073 741 824 bytes.
  • base10 β€” display all sizes in Base 10, except for sizes of RAM, which use base 2 with IEC prefixes.

everything except RAM:

1 kB = 1 000 bytes.
1 MB = 1 000 kB = 1 000 000 bytes.
1 GB = 1 000 MB = 1 000 000 kB = 1 000 000 000 bytes.

RAM:

1 KiB = 1 024 bytes.
1 MiB = 1 024 KiB = 1 048 576 bytes.
1 GiB = 1 024 MiB = 1 048 576 KiB = 1 073 741 824 bytes.
  • historic β€” display all sizes in Base 2, without IEC prefixes.
1 KB = 1 024 bytes.
1 MB = 1 024 KB = 1 048 576 bytes.
1 GB = 1 024 MB = 1 048 576 KB = 1 073 741 824 bytes.
not recommended. this style uses base units 2 with prefixes usually associated with base 10 units. while it uses KB rather than the SI (base 10) kB, there is no such distinction beyond the kilobyte range, and the units are ambiguous. 🚩 like bestie, the ambiguity is not the vibe, do not do this one

🌈 ENVIRONMENT 🌈

  • BYTEPREFIX β€” this environment variable will override the configured or default style. it should just contain one of the style names, listed in OPTIONS above. just one. one single style name. that's it 🫢
  • XDG_CONFIG_HOME β€” the location of the user's configuration files. if it's not set, it will be assumed to be ~/.config.

πŸ¦‹ FILES πŸ¦‹

your preferred style can be set in a system-wide configuration file and/or in your own configuration file β€” and the user's own config file takes precedence, as it should πŸ‘‘ if no configuration file exists, the default style is base10.

  • /etc/byteprefix or XDG_CONFIG_HOME/byteprefix β€” this file should contain a single line: format=style. lines beginning with # are treated as comments.

⭐ EXAMPLE ⭐

a user wanting base 2 display can set the following in ~/.config/byteprefix:

format=base2

slay, that's it, that's the whole setup πŸ’–


πŸ”₯ SEE ALSO πŸ”₯

units(7)


and that's the page bestie! this one's from libkibi, dated January 2011 🌸 go forth and configure your size display however your heart desires, and remember: historic is right there but so is the warning label πŸ’€ mwah πŸ’…βœ¨

πŸ“¦ where this page comes from