BITS(1) Dienstprogramme für Benutzer BITS(1)

bits - Bitmasken aus oder in verschiedene Formate umwandeln

ÜBERSICHT

bits [-h] [-V] [-w <ZAHL>] [<MODUS>] [<MASKE_ODER_LISTE> …]

Das Dienstprogramm bits wandelt Bitmasken verschiedener Formate ineinander um. Es unterstützt mittels bitweiser Operationen die Kombination mehrerer Bitmasken

<MASKE_ODER_LISTE>

A set of bits specified as a hexadecimal mask value (e.g. 0xeec2) or as a comma-separated list of bit IDs.

If no argument is specified, the sets of bits will be read from standard input; one group per line.

Consecutive ids can be compressed as ranges (e.g. 5,6,7,8,9,105-10).

Optionally, if an argument starts with a comma, it will be parsed as a single hexadecimal mask split in 32bit groups (e.g. ,00014000,00000000,0002000017,78,80).

By default all groups will be OR’ed together. If a group has one of the following prefixes, it will be combined with the resulting mask using a different binary operation:

&<MASKE_ODER_LISTE>

The group will be combined with a binary AND operation. I.e. all bits that are set to 1 in the group AND the combined groups so far will be preserved to 1. All other bits will be reset to 0.

^<MASKE_ODER_LISTE>

The group will be combined with a binary XOR operation. I.e. all bits that are set to 1 in the group AND to 0 the combined groups so far (or the other way around) will be set to 1. Bits that are both to 1 or both to 0 will be reset to 0.

~<MASKE_ODER_LISTE>

All bits set to 1 in the group will be cleared (reset to 0) in the combined groups so far.

-w <ZAHL>, --width <ZAHL>

Maximum number of bits in the masks handled by bits (default 8192). Any bit larger than this number will be truncated.

-h, --help

zeigt einen Hilfetext an und beendet das Programm.

-V, --version

zeigt Versionsinformationen an und beendet das Programm.

Einer der folgenden Umwandlungsmodi kann angegeben werden. Falls nichts angegeben ist, wird -m, --mask als Vorgabe verwendet.

-m, --mask

gibt die kombinierten Argumente als hexadezimalen Maskenwert aus (Vorgabe).

-g, --grouped-mask

gibt die kombinierten Argumente als hexadezimalen Maskenwert in durch Kommata getrennten 32-bit-Gruppenn aus.

-b, --binary

gibt die kombinierten Argumente als binären Maskenwert aus.

-l, --list

gibt die kombinierten Argumente als Liste von Bit-IDs aus. Aufeinanderfolgende IDs werden als Bereiche zusammengefasst.

~$ 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

Robin Jarry.

Nutzen Sie zum Melden von Fehlern das Fehlererfassungssystem https://github.com/util-linux/util-linux/issues.

Der Befehl bits ist Teil des Pakets util-linux, welches aus dem Linux-Kernel-Archiv https://www.kernel.org/pub/linux/utils/util-linux/ heruntergeladen werden kann.

2025-06-24 util-linux 2.41.1