Ask Your Question

Map pressed keys to key codes

asked 2018-09-21 04:16:38 -0500

joaooneillcortes gravatar image

updated 2018-09-21 04:35:33 -0500

I am investigating commands bound to key sequences on GNU bash, version 4.4.12. I found out the bind -P command, wich lists every command bounded. However, I don't know a way to find which keys should I press to obtain a certain code, for instance, \e[200~. Is there any commands that takes a code and returns a possible key sequence that types it? In a way, an inverse command to read?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-09-21 05:26:36 -0500

villykruse gravatar image

For "\e[200~" there is not key sequence. It is magic sequence to support bracketed paste, that is, to tell some application program that the following text is coming from copy-past and not from the keyboard. See for further information. The gvim program, for example, uses this to turn off auto-format when pasting in code snippets.

In general, you can switch to a not-graphical terminal (ctrl-alt-F4) and run the cat command. Then hit various function keys and you can see the character sequences they generate.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-09-21 04:16:38 -0500

Seen: 95 times

Last updated: Sep 21 '18