-2

What is the key denoted by ^@ when typed in the terminal?

My system is getting spammed by this key, so I have to disable it.

8

2 Answers 2

5

^@ is not a key, it's the representation of a control character. In that case the NUL character, the one with byte value 0.

If n is the byte value of X, then the byte value of ^X will be n ^ 0x40.

You can tell the byte value of X with:

printf X | od -An -tu1

or (for single byte characters):

printf '%d\n' "'X"

So here:

$ printf '%s\n' "'@"
64
$ echo "$((64 ^ 0x40))"
0

For ^?:

$ printf '%s\n' "'?"
63
$ echo "$((63 ^ 0x40))"
127

(that's the DEL character).

Depending on the terminal, you may be able to enter it by pressing Ctrl+Space or Ctrl+@. On my UK keyboard in xterm on Debian, I get it on Ctrl+2 (shift 2 is " on a UK keyboard, but @ on a US keyboard).

The NUL character is ignored by terminals and terminal emulators. It's a padding character which in the olden days would have been used by applications to let give the terminal time between two other control characters when there was no flow control.

You'd see that ^@ in a terminal in applications like vim that choose it as the visual representation of a NUL. You would also typically see it as the echo of a NUL character you enter on input. Either by the terminal driver itself when the terminal line discipline is in icanon mode and the echoctl parameter is enabled (generally on by default, see stty -a), or by line editors in applications (like readline used by bash).

5
  • Thanks. Any idea as to why my terminal is getting spammed by these characters?
    – Binoy Babu
    Jun 8, 2018 at 12:50
  • @BinoyBabu, I've added more information. How exactly is it spamming your terminal? do you see those ^@ as if they had been entered on the keyboard (can you delete them with backspace?) ? Or are they being output by some application? What is running in that terminal when that happens? What's the terminal? A real terminal? A terminal emulator like xterm? Please edit your question to add the extra information. Jun 8, 2018 at 13:09
  • It blocks me from typing in the keyboard sometimes, and ^@ shows up in the terminal that shows boot progress. No I cannot delete it. It doesn't show up in the terminal app.
    – Binoy Babu
    Jun 8, 2018 at 13:12
  • @BinoyBabu, on what hardware? What operating system? Is that after logging in on that terminal that shows boot progress? What input device are connected to that machine? Does the problem go away if you unplug some of them? Jun 8, 2018 at 13:19
  • Ideapad 320 notebook, Ubuntu 18.04. Not after logging in, this charecter appears to get spammed into the boot progress output. No extra input devices connected.
    – Binoy Babu
    Jun 8, 2018 at 13:22
2

That is character 0, ctrl-@. Eg. Ctrl-A is character 1, Ctrl-M character 13 or newline.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .