Ubuntu – Why does ^C, ^V etc. appear in the terminal when I use the Ctrl+character keyboard shortcut

command line

Sometimes, when copy-pasting text from the output of commands, I'll accidently use Ctrl+c instead of Ctrl+Shift+c.

So the command-line interprets it as ^C

Why is this? Why does the command-line interpret control input as ^?

Best Answer

It does not actually insert the character sequence "^C". This is only a representation for unprintable ASCII control characters, such as:

  • ^C → ETX (End of text, sends a kill signal), ASCII 0x03
  • ^D → EOT (End of transmission, terminates input), ASCII 0x04
  • ^H → BS (Backspace, \b), ASCII 0x08
  • ^J → LF (Line feed, \n), ASCII 0x0A
  • ^L → FF (Form feed, new page, clears the terminal), ASCII 0x0C
  • ^M → CR (Carriage return, \r), ASCII 0x0D

This is only a small extract of possible ASCII control characters that can be inserted using the keyboard; you can find a full list here.

I think the most important ones to remember are Ctrl+C, Ctrl+D and Ctrl+L.