Terminal and Serial Line Settings
you need to find out what characters are generated by
labeled keys like arrows,
and Function Keys.
If you have a terminal manual handy, the information should be listed
somewhere in there.
If not, you can
read the termcap
Unfortunately, not every entry is complete - a terminal may have
capabilities that aren't described in its entry.
In any event, if you don't know the syntax well, finding the right
information can be difficult.
there are several online techniques for finding out what character is sent by
a special key. Each has drawbacks, but between them,
you can almost always find out what character a key generates.
Enter insert mode in vi
control sequence (31.6
to quote each special key.
That is, type
followed by the key whose identity you are
trying to discover. A printable representation of the key should
appear on the screen.
This will not work if the key generates a sequence
containing more than one non-printing character, since ^V
will only quote the first one. It also will not work for
keys that generate a newline (such as the down-arrow key on
the Wyse-50 keyboard)-but in such a case, the action of the
key should be obvious.
At the command line, print:
-echo; cat -v; stty echo
and then type the special keys, each followed by a carriage return.
will echo the translated version on the screen. When you
are finished, type
Simply type the special key at the shell prompt.
As long as the key does not have a special meaning (for example,
to interrupt jobs or
for end of input),
the command generated by the key will be executed
on the terminal. Depending on the version of UNIX you use,
a printable equivalent to the command generated by the key you
pressed may also be printed as the command is executed.
(Keep in mind that with full-duplex communications,
characters are not sent from your keyboard directly to your
terminal but are sent to the system and echoed back to the terminal.)
On some systems, the control character is recognized on
input and is echoed in two separate ways: as
a printable representation of the control character (e.g.,
-literally, caret-Z) and as the actual control
character. Other systems echo only the actual control
character, which means that you see the effect but not the
character that caused it.
In either case, the shell will give an error message
containing the character(s)
typed as soon as you press
The message should read something like this:
^[[U : Command not found.
If, on the other hand, the key generates a sequence that is meaningful to the
device, some standard function, such as interrupt,
end-of-file, or suspend, will be executed. You can find out
what command invokes each of these functions using