Reverse control-code look up for terminals
infocmp
can help. It writes escape as \E
rather than \e
or ^[
.
For example, to find \e[A
, which is your history-search-backward:
$ infocmp -1x | grep -F '=\E[A,'
cuu1=\E[A,
$ man 5 terminfo | grep ' cuu1 '
cursor_up cuu1 up up one line
Which tells you to press cursor up, a.k.a. up arrow.
Note that you will need the -x
flag (shown above) to display some combinations, e.g. Ctrl+<-.
These extended keys are not part of the standard, so they aren't listed in the terminfo man page, but they are documented in the terminfo file.
Also note that the control sequences vary depending on which terminal you use.
You can get information about a different terminal by using infocmp -1x <terminal>
, e.g. infocmp -1x rxvt
, infocmp -1x putty
, etc.
Once you figure out which one terminfo thinks you have, things will be easier if you set your TERM
variable to match.