BITS(1)

๐Ÿ’– BITS(1) โ€” the girlies' guide to bit masks ๐Ÿ’–

okay so bestie, welcome to bits โœจ it's the user-commands era of your terminal and we're converting bit masks or lists from/to various formats. no cap, it's giving โœจutilityโœจ.


๐ŸŒธ NAME ๐ŸŒธ

bits โ€” convert bit masks or lists from/to various formats ๐ŸŽ€


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

bits [-h] [-V] [-w number] [mode] [mask|list]...

like. that's it. that's the whole vibe check. ๐Ÿ’…


๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

The bits utility converts between bit masks and bit lists. fr fr. and it also supports combining multiple masks or lists using bitwise operations, which is lowkey the main character energy of this whole thing. ๐Ÿ‘‘


๐ŸŒˆ POSITIONAL ARGUMENTS ๐ŸŒˆ

  • mask โ€” a set of bits specified as a hexadecimal mask value. for example: 0xeec2 ๐Ÿ’ซ
  • list โ€” a set of bits specified as a comma-separated list of bit IDs. for example: 1,5,29,32 ๐Ÿ“

so if you pass no argument at all, the sets of bits will be read from standard input, one group per line. yes queen, stdin is a valid lifestyle. ๐Ÿซถ

Consecutive IDs can be compressed as ranges โ€” for example: 5,6,7,8,9,10 โ†’ 5-10. it's giving โœจefficiencyโœจ.

Optionally (the way that this is so fun), if an argument starts with a comma, it will be parsed as a single hexadecimal mask split in 32-bit groups. for example:

,00014000,00000000,00020000 โ†’ 17,78,80

iconic. ๐Ÿ™ˆ

By default, all groups will be OR'ed together. but if a group has one of the prefixes &, ^, or ~, it will be combined with the resulting mask using a different binary operation. so here's the tea on each one ๐Ÿ‘‡

  • &mask | &list โ€” the group will be combined with a binary AND operation. That is: all bits that are set to 1 in the group AND in the combined groups so far will be preserved as 1. All other bits will be reset to 0. ๐Ÿ’€
  • ^mask | ^list โ€” the group will be combined with a binary XOR operation. That is: all bits that are set to 1 in the group AND to 0 in the combined groups so far (or the other way around) will be set to 1. Bits that are set both to 1 or both to 0 will be reset to 0. literally a "we're different or we're nothing" situation ๐Ÿ˜ญ
  • ~mask | ~list โ€” All bits set to 1 in the group will be cleared (reset to 0) in the combined groups so far. bye bestie, you're gone now ๐Ÿ‘‹

โœจ OPTIONS โœจ

  • -w number, --width number โ€” The maximum number of bits in the masks handled by bits. The default is 8192. Any bit larger than this number will be truncated. ๐Ÿšจ not me watching your bits get snipped ๐Ÿšจ
  • -h, --help โ€” Display help text and exit. ๐Ÿซถ
  • -V, --version โ€” Display version and exit. ๐Ÿ’…

๐ŸŽ€ CONVERSION MODE ๐ŸŽ€

One of the following conversion modes can be specified. If not specified, it defaults to -m, --mask. the default is literally the default, we love a low-effort queen.

  • -b, --binary โ€” Print the combined arguments as a binary mask value. 0b girlies rise up ๐ŸŒˆ
  • -g, --grouped-mask โ€” Print the combined arguments as a hexadecimal mask value in 32-bit comma-separated groups. organized. โœจ
  • -l, --list โ€” Print the combined arguments as a list of bit IDs. Consecutive IDs are compressed to ranges. ๐Ÿ“
  • -m, --mask โ€” Print the combined arguments as a hexadecimal mask value (default). ๐Ÿ‘‘

๐Ÿ”ฅ EXAMPLES ๐Ÿ”ฅ

ok bestie, these are shown verbatim, do NOT come for me about the formatting, this is exactly what the page says ๐Ÿ’€
~$ bits --mask 4,5-8 16,30
0x400101f0
~$ bits --list 0xeec2
1,6,7,9-11,13-15
~$ bits --binary 4,5-8 16,30
0b100_0000_0000_0001_0000_0001_1111_0000
~$ bits --list ,00300000,03000000,30000003
0,1,28,29,56,57,84,85
~$ bits --list 1,2,3,4 ~3-10
1,2
~$ bits --list 1,2,3,4 ^3-10
1,2,5-10
~$ bits --grouped-mask 2,22,74,79
8400,00000000,00400004
~$ bits --width 64 --list 2,22,74,79
2,22

like??? she ATE with these examples. ๐Ÿ’…โœจ


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

Robin Jarry. yes, the one and only. give her her flowers ๐Ÿ’


๐Ÿ˜ญ REPORTING BUGS ๐Ÿ˜ญ

For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues.

ngl bestie if you found a bug, go tell them, they wanna know. don't suffer in silence ๐Ÿซถ

๐ŸŒˆ AVAILABILITY ๐ŸŒˆ

The bits command is part of the util-linux package which can be downloaded from the Linux Kernel Archive at https://www.kernel.org/pub/linux/utils/util-linux/. ๐ŸŒธ


okay that's the whole page!! this came to you from the util-linux 2.42.4 release, dated 2026-09-21 โ€” go forth and mask your bits, bestie, you've got this ๐Ÿ’–โœจ๐ŸŽ€๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from
  • arch rolling: util-linux 2.42.4-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ISC AND LGPL-2.1-or-later AND LicenseRef-PublicDomain
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms