Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In readline(3) I should be able to map Control-Backspace to the same function as Control-W (unix-kill-rubout). Regardless of what I put in ~/.inputrc I'm unable to get this to be recognized.

\C-\b: unix-kill-rubout

...for instance does not work. Can I map Control-Backspace to the unix-kill-rubout in readline?

share|improve this question

I doubt your terminal will send a special code for ctrl-backspace. Backspace is normally ctrl-?, and you can't add another ctrl modifier to a ctrl character.

One alternative might be to have your terminal send a special escape sequence for Ctrl-Backspace, then map that in your readline config.

share|improve this answer


"\C-_": unix-word-rubout

to .inputrc seems to work for me.

The C-_ represents control underscore. This is what my terminal sends when pressing CTRL+Backspace.

Pressing CTRL+V then a key combination will echo it's code to the console. For me, pressing CTRL+V then CTRL+Backspace echoes ^_ with ^ meaning CTRL. In .inputrc \C- is the CTRL modifier so \C-_ is what's needed here. You can use this technique to determine other key combinations you may want to use..

share|improve this answer

Are you looking for unix-word-rubout or kill-word ? I don't think unix-kill-word exists.

share|improve this answer
Hi, .inputrc actually says unix-kill-rubout, I don't know why I kept thinking it was unix-kill-word. Regardless, it still just asks like regular backspace. – Xepoch Jan 14 '10 at 6:48

For the linux terminal, you can do it by modifying the keymap you load on startup. In ubuntu my default it loads /etc/console-setup/cached.kmap.gz. If you find the entry corresponding to Ctrl-Backspace (probably Control-Delete is listed as Backspace already) then you could change that to Control_w. Not sure about terminal emulators, but konsole (the default KDE terminal emulator) has quite nice settings for keybinds. Hope that helps :)


share|improve this answer

This works for me (in urxvt, bash):

share|improve this answer

As graywh points out backspace is often represented by ^?. In order to bind to ctrl+bksp in your .inputrc file you may need modify your readline library. This ubuntu tutorial includes a new .keytab file which can override the default output.

On my system this let me add "\e[9;3~": backward-kill-word to my .inputrc.

As readline behavior seems to vary somewhat based on your system, it's worth noting I'm using Konsole on Kubuntu.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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