Which application can I use to figure out what to put in .inputrc for any custom keyboard shortcut? I've tried a few, and none of them seem to be usable:

showkey, showkey -a and read just print ' if you press Ctrl-'.

xev prints them separately, and doesn't print anything that seems usable for .inputrc.


I believe ctrl-' will not be passed to applications in the console. It also doesn't show up in xev.

It may be the input system or even PC hardware, but without trickery some of the key combinations may be impossible to detect.

cat -v

Then just press the keys that you're trying to map. Its kinda crude, but it mostly works for that kind of thing. Job control keys and Ctrl-V will still do what they do, but for most other keys like function keys, arrow keys, etc., you can see the sequence it generates. Just remember the ^[ part is the escape code and you replace that with \e in the .inputrc file.

  • I don't see the advantage over any of the other tools. Also, it prints ' for Ctrl-', just like the other tools. – l0b0 Mar 19 '12 at 14:54
  • Well I just thought it was another option to try. I see the problem with Ctrl-' now. That's weird that the ;, ', , and . keys don't generate control sequences. Neither do the number keys. Never noticed that before. – deltaray Mar 19 '12 at 15:01
  • 2
    @l0b0 Most terminals do not generate different key sequences for Ctrl+' and '. This can be configured in some terminal emulators such as Xterm. – Gilles Mar 19 '12 at 18:23
  • Is Ctrl+' used for something specific? Is it something that legacy systems had or something? – deltaray Mar 20 '12 at 19:42

You can also simply use Ctrl+V which will "quote" your next key sequence.


You would need a program that reads input in non-canonical mode and then display the bytes that has read. Personally, I don't know any such program, so I use cat and pipe the output through od to see the individual bytes, which appears to work 99% of the time. When a key interacts with the terminal (e.g. moves the cursor, deletes a character) you have to quote it with Ctrl-V though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.