I understand that the format for key bindings in inputrc file is:

keyname: function-name or macro

For keyname, I saw things like:


What is the meaning of these keynames, and what is the general format for keyname ? Please share a link to docs.

  • 2
    For your docs, I'd recommend looking at the readline(3) manpage or the readline user manual.
    – jw013
    Nov 11 '11 at 6:10
  • 1
    Check you key configuration (readline - inputrc) via: $ bind -p
    – vigo
    Nov 21 '15 at 19:35

Keybinding can be done using one of the following forms:

  1. keyname: command_name
  2. "keystroke_sequence": command_name

In first form you can spell out the name for a single key. For example, CONTROL-U would be written as control-u. This is useful for binding commands to single keys.

In the second form, you specify a string that describes a sequence of keys that will be bound to the command. The one you gave as an example is the emacs-tyle backslash escape sequences to represent the special keys

\C - Control
\M - Meta
\e - Escape

You can specify a backslash using another backslash – \\. Similarly ' and " can be escaped too - \' and \"


These characters is what is interpreted by your terminal when you press special keys. You don't want to bind regular alphabets and numerics in your key binding as you might be using them on regular basis and can cause issues when you accidentally hit a combination that has been mapped in your ~/.inputrc or /etc/inputrc file.

[1~ is what is interpreted by your terminal when you press your HOME button. 

To learn more, simply type read on your terminal prompt and press all types of special keys like Function Keys, HOME, END, Arrow Keys etc and see what gets displayed.

Here is a small reference I found that can offer some basic understanding. Good luck! :)

  • 2
    What does \e[1~, \M-l and \C-[OD mean? The \e, \M, and \C parts are clear. How about the rest? For example: [1~ - Should I press Shift+{+1+Shift+`? Nov 11 '11 at 21:25
  • I have updated the answer for you. Hope that helps! Nov 12 '11 at 2:00
  • The link is broken. Still don't know what the tilde or open bracket are for??
    – Carl Smith
    Jul 17 '16 at 23:32

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.