My understanding is that terminals often use ANSI control-codes to represent non-alphanumeric character sequences. For example, when editing .inputrc
for Bash in Linux, it's easy to find code sequences that look as follows:
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
The commands above define key bindings for the Bash commands history-search-backward
, etc..
Now, in bash, I can use read
to see how characters typed in my keyboard are mapped to ANSI control codes. E.g. For example, if I run read
, and then enter Ctrl-P
, I get: ^P
. Similarly, if I enter Alt-W
, I get: ^[W
.
My question is: Is there a program, tool or website that does the opposite? I.e. a tool that outputs or shows the sequence of keyboard keys that I need to type on my keyboard to obtain a given ANSI control-code sequence. For example, entering ^[W
should output: Alt-W
Thanks!