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

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.


Because CTRL+KEY combos are interpreted by the terminal as non-printable ASCII characters, and being those non-printable you need a way to represent them.

The convention, stemming from VT terminals with ANSI support, is to represent the CTRL+KEY combo representing CTRL with a caret (^) and KEY with KEY.


When copying and pasting to/from a terminal, it is best practise to use the short cuts Ctrl+Insert and Shift+Insert respectively.

These are the more traditional short cuts for terminal use, though you'll note that in an X graphical environment Ctrl+Insert and Shift+Insert are tied to the same Ctrl+C and Ctrl + V.

In most terminals Ctrl+C (represented by ^C) are used to halt the execution of a process, hence pasting with that short cut won't work.

For quick copying and pasting, you can utilize X's primary buffer by highlighting whatever text you want to copy, and then middle-clicking where you want to paste it. No keyboard required.

Tags:

Command Line