What I want to do is made C-h not send backwards-delete-char

there is nothing about it in my inputrc files but is shows up in bind -p

  • It is default for both vi and emacs mode, check man readline | grep "C-H" . Try adding "\C-h": "" to your ~/.inputrc file.
    – user996142
    Commented Jun 30, 2017 at 16:00

3 Answers 3


C-h is bound to backward-delete-char by default. If you don't like that, bind it to a different command in your .inputrc, e.g.

"\C-h": nop

to make it do nothing.

Note that if your terminal sends C-h for the BackSpace key¹, and C-h is not explicitly bound to an existing command (so not nop), then C-h will execute backward-delete-char.

¹ More precisely, if your terminal's configuration tell applications that this is so. This is the erase character in the stty settings. You can display stty settings by running stty -a.


Binding to the nop will suppress the key action, but won't help in case you want to free up the key to be a prefix. Suppose you want to dedicate "M-c" as a prefix to a set of related macros, for example, such that the sequence "M-c M-i" is bound to a macro that simply types a long command controlct sensor instance. Naturally, "M-c M-d" would print something else, and so on.

But there is a default binding "\ec": capitalize-word", that would stand in your way. If you print the key sequence "M-c M-i" fast enough (specifically, within the time in milliseconds set by the keyseq-timeout readline variable), you'll get the desired behavior. But if you linger, bash will execute the "M-c" default binding alone, i. e. the nop command. So in this case, you really need to unbind the key, not rebind it to something that does nothing.

Fortunately, readline supports that quite easily (@user996142 provided the correct syntax and a reference in a comment):


alone on a line by itself. This clears the binding.

Warning time: Do restart bash (e. g., exec bash -l), not just reload the .inputrc file with "C-x C-r". readline may not report the binding after the reload (bind -l does not show it, and bind -q capitalize-word happily reports "capitalize-word is not bound to any keys," but still times out it, just as if it were bound to nop. This is a bug in some versions of either bash or readline.

  • 1
    this answer should have been the accepted one.
    – xdavidliu
    Commented Apr 11, 2020 at 2:21

I had to unbind using the following. The elusive important piece for me was adding the surrounding single quotes.

FWIW, numerous variations work when running the command directly in the shell. But when including the command in .inputrc or a .sh file, this is the only thing that I found to work.





The following -u <readline command name> also seems to work sometimes.

bind -u yank
bind '"\C-y":'  
  • note the syntax is slightly different for .inputrc files vs the shell, so you won't find something that works for both (bind command and surrounding single quotes needed in the shell). Using this syntax in inputrc results in readline: `'': missing closing quote for macro. Commented Dec 7, 2023 at 4:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .