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.


1 Answer 1


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
    Commented Dec 4, 2016 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
    Commented Dec 4, 2016 at 19:14
  • 2
    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
    Commented Dec 4, 2016 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
    Commented Dec 4, 2016 at 21:52
  • 1
    @rexroni: The question was about mapping them to different function in the application. What you found is a method to remap the keys in xterm itself, not in the application. If you apply the method then the application will never see the Tab, or Backspace, or whatever key.
    – AlexP
    Commented Dec 5, 2016 at 5:01

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