I am running Debian Jessie. I am using Xterm, though I would prefer an answer which works in a virtual terminal as well. Here, "backspace" is the key with the backwards arrow, two keys above the "enter" key on a typical US PC keyboard layout, if that is relevant.

I would like to have two separate shortcuts: "control+h" to move the cursor one character to the left (a modified vim keybinding of sorts) and "control-backspace" to delete the word before my cursor (traditionally the "control-w" functionality).

My problem is that I can only set one of those shortcuts in my .inputrc, because typing "control+backspace" is interpreted as if I had pressed control-h instead.

How can I separate these key's functionalities? I have read a lot of information on it but have only become more confused.

marked as duplicate by Gilles, techraf, HalosGhost, Community Dec 5 '16 at 3:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Unlike graphical applications, character-cell applications (those that run in terminals) do not see keystrokes, they see characters. The way Linux sets up the keyboard, ‹Ctrl›‹Backspace› is ‹Ctrl›‹H›, that is, character ‹U+0008› (and plain ‹Backspace› is ‹Del›, which is character ‹U+007F›, usually visualized as ^? and very different from what the ‹Delete› key generates).

They are not different keys. They are the same. If your shell is Bash, then you can see what characters are sent by a certain key by pressing ‹Ctrl›‹V› and then that key.

  • It makes sense what you say that they are outputing the same characters to character-cell applications, but then why isn't there a way to change the character that is given to the character-cell application from a control-backspace keystroke? – rexroni Dec 4 '16 at 16:20
  • For the graphical terminal emulators you can of course play with xmodmap and assign other symbols to keycode 22... and generally remapping your keyboard according to taste. – AlexP Dec 4 '16 at 19:14
  • The basic problem is that a terminal emulator (or a terminal console) aims to emulate an actual terminal, usually a VT220 or a VT100. In the olden days when VT terminals ruled, characters above 127 were considered exotic. Characters 0 to 127 are divided into 95 printable characters (33 to 126) and 33 control characters (0 to 31, that is Ctrl-@, Ctrl-A, Ctrl-B, Ctrl-C ... Ctrl-H aka BS, Ctrl-I aka Tab ... Ctrl-J aka LF ... Ctrl-M aka CR ... Ctrl-Z, Ctrl-[ aka Esc, Ctrl-\, Ctrl-^, Ctrl-], and 127, Ctrl-?, aka Del). That's why key Escape is the same as Ctrl-[, Tab as Ctrl-I, and Enter as Ctrl-M. – AlexP Dec 4 '16 at 19:29
  • I toyed with the xmodmap, but that's not really what I want because there are a ton of programs with "control-backspace" functionality which I don't want to break. – rexroni Dec 4 '16 at 21:52
  • Downvote because there specifically is a way to do it in xterm, as shown in the question which I accidentally duplicated. – rexroni Dec 5 '16 at 3:16

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