An index of non-letter control characters
In Unix and ASCII, bytes 1 through 26 are control-A through control-Z. But there are control characters outside that range: 0, 27 through 31, and 127. As a result of writing up my _.screenrc I've become curious about what all of them are, so here's my handy chart:
|0||Ctrl-@||also Ctrl-`, Ctrl-space, Ctrl-2 in
|27||ESC, Ctrl-[||also Ctrl-5 in
|28||Ctrl-\||also Ctrl-4 in
|29||Ctrl-]||also Ctrl-3 in
|30||Ctrl-^||also Ctrl-~, Ctrl-6 in
|31||Ctrl-_||also Ctrl-/, Ctrl-7 in
|127||DEL, Ctrl-?||also Ctrl-8 in
The canonical representation of a control character is based on
what Unix prints it as when you enter it (usually with Ctrl-V
followed by the character, however you generated it). It turns out
xterm will generate a number of these sequences with alternate
Ctrl combinations as noted in the chart (which is probably not
complete). Some of these
xterm alternates may be more convenient
under some circumstances.
Your mileage on actual serial terminals and other terminal emulators
may vary, although
urxvt match up for the
primary control sequences and at least some of
ways of generating them. Historically serial terminals could be
very variable outside Ctrl-A through Ctrl-Z.
Backspace traditionally sends Ctrl-H. Ctrl-\ is traditionally what
stty will report as 'quit', ie it sends SIGQUIT ('please die down
with a core dump') to programs; this can make it kind of hard to
work out just what ASCII code it represents. I resorted to entering
vi, saving the file, and then using
od to dump the file.
In case you ever need to know this, Ctrl-J is the real end of line
character in terminal entry, aka
\n; the tty driver maps Return
(aka Ctrl-M aka
\r) to it normally, but this can be disabled and
then you can be stuck if, eg, you crashed a program that uses 'raw
mode' when you were trying to work out the ASCII
number for Ctrl-\. Many but not all shells will accept Return (or
a literal Ctrl-M) as a synonym even in this situation, so you can
type commands, but any actual command that prompts you for something
(The specific tty mode flag this is controlled by is
CBreakAndRaw. It follows that '
stty icrnl' will help restore a
broken session, although you might as well go all the way to '
Sidebar: the odd case of
Konsole works just like
xterm with the sole exception that Ctrl-?
does not seem to generate a Ctrl-? (it can be generated with Ctrl-8,
though). Instead konsole appears to swallow Ctrl-? outright, which
may have something to do with some sort of magic DEL handling it's