Home Explore Blog CI



nushell

commands/docs/bits_not.md
1692153d1ff9fba4019fbf55c6e58ae69c134b273a41bddb000000030000070a
---
title: bits not
categories: |
  bits
version: 0.104.0
bits: |
  Performs logical negation on each bit.
usage: |
  Performs logical negation on each bit.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `bits not` for [bits](/commands/categories/bits.md)

<div class='command-title'>Performs logical negation on each bit.</div>

## Signature

```> bits not {flags} ```

## Flags

 -  `--signed, -s`: always treat input number as a signed number
 -  `--number-bytes, -n {int}`: the size of unsigned number in bytes, it can be 1, 2, 4, 8, auto


## Input/output types:

| input        | output       |
| ------------ | ------------ |
| binary       | binary       |
| int          | int          |
| list\<binary\> | list\<binary\> |
| list\<int\>    | list\<int\>    |
## Examples

Apply logical negation to a list of numbers
```nu
> [4 3 2] | bits not
╭───┬─────╮
│ 0 │ 251 │
│ 1 │ 252 │
│ 2 │ 253 │
╰───┴─────╯

```

Apply logical negation to a list of numbers, treat input as 2 bytes number
```nu
> [4 3 2] | bits not --number-bytes 2
╭───┬───────╮
│ 0 │ 65531 │
│ 1 │ 65532 │
│ 2 │ 65533 │
╰───┴───────╯

```

Apply logical negation to a list of numbers, treat input as signed number
```nu
> [4 3 2] | bits not --signed
╭───┬────╮
│ 0 │ -5 │
│ 1 │ -4 │
│ 2 │ -3 │
╰───┴────╯

```

Apply logical negation to binary data
```nu
> 0x[ff 00 7f] | bits not
Length: 3 (0x3) bytes | printable whitespace ascii_other non_ascii
00000000:   00 ff 80                                             0××

```

Chunks
f757d455 (1st chunk of `commands/docs/bits_not.md`)
Title: bits not: Perform logical negation on bits
Summary
The `bits not` command performs logical negation on each bit of the input. It supports binary and integer inputs, as well as lists of these types. Flags allow specifying the size of the number in bytes and whether to treat the input as signed.