Finding Out What Characters Your Terminal's Special Keys Send

Sometimes, when writing vi keymaps (, ), you need to find out what characters are generated by labeled keys like arrows, HOME, 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 or terminfo entry (). 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.

However, 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.

- JS, TOR