Hi I'd like to change the key mappings slightly in xfce4-terminal, maybe similar to adding Xterm.VT100.translations to .Xresources.

In particular, I want to make ctrl-backspace delete the last word, and ctrl-delete delete the next word.

Bonus: I'd like to make alt act like ctrl (duplicate functionality) for backspace, delete, left arrow, right arrow.

How to do all or any of these things in xfce4-terminal ?

EDIT: Progress so far: I'm using bash, and bash uses the the readline library and a bash built-in function, "bind," to map key sequences to readline functions. The functions I need turn out to be "shell-kill-word" and "shell-backward-kill-word." In principle, I should be able to do something like this:


However, the xfce4-terminal emulator, or some component higher upstream in the process (could it be the window manager, xfwm4, the Xorg program itself?) is not cooperating. In general, the meta key is translated to an Escape character, for example this works:

"\ey":shell-kill-word  <-- Meta + y kills next word

but with the the backspace and delete keys I'm out of luck. I tested the keycodes from two terminal emulators, xfce4-terminal and xterm, generated by backspace and delete and control-key combinations on my keyboard. Here they are, as reported by emacs's C-h C-l command:

  backspace:    DEL
  delete:       \e[3~
  \C-backspace: \C-h
  \C-delete:    \e[3;5~
  \M-backspace: y-umlaut (y with two dots over it)
  \M-delete:    nothing

  backspace:    DEL
  delete:       \e[3~
  \C-backspace: DEL
  \C-delete:    \e[3;5~
  \M-backspace: \e DEL
  \M-delete:    nothing

In particular, in xfce4-terminal it is impossible to bind \C-backspace to shell-backword-kill-word because it sends the exact same keycode as a regular backspace. And it's impossible to bind \M-delete to shell-kill-word because it doesn't send a keycode at all.

I'm frustrated because one (big) reason for switching to Linux and dealing with all the hardware/software compatibiltiy issues is that Linux is so customizable. I like having my windows get focus when I mouse over them for example, rather then click on them. Addressing problems like this one in modern Linux distros would seem to me to be a high priority task. Unfortunately I don't have time to do all the background research into X, and xfce I need to do to take the next step in solving this problem. Can someone with more knowledge of the Xorg ecosystem point me in the right direction? Perhaps there is an alternative terminal emulator that does this better?

Final piece of info: running emacs in an X window, it gets all but one of the keycodes:

backspace:    <backspace>
delete:       <delete>
\C-backspace: <C-backspace>
\C-delete:    <C-delete>
\M-backspace: <M-backspace>
\M-delete:    nothing
  • Have you tried doing it at shell level? I have a few of those you need configured on my .zshrc
    – lmcanavals
    Nov 2, 2014 at 4:12
  • yes, that's the type of option I'm looking for, esp if it works! Can you give an example from your zshrc?
    – Colin
    Nov 3, 2014 at 18:00
  • Have you got Meta-delete bound to something in the window manager? Only it's odd that you don't see M-DEL in Emacs.
    – l0st3d
    May 17, 2017 at 14:48

2 Answers 2


Okay here is what I have on my .zshrc for ctrl+, ctrl+ and alt+, alt+

## use Ctrl <- and Ctrl -> for jumping to word-beginnings on the CL
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word                       
## the same for alt-left-arrow and alt-right-arrow            
bindkey '^[[1;3C' forward-word                          
bindkey '^[[1;3D' backward-word

On my system these work for crtl+del and alt+del but I haven't found the keys for ctrl+backspace and alt+backspace.

bindkey '^[[3;5~' kill-word
bindkey '^[[3;3~' kill-word

You enter those odd characters that represent each key combination by pressing Ctrl+V followed by the key combination you want. For example pressing Ctrl+V followed by Ctrl+ produces ^[[1;5D

  • Thanks Martin - your solution pointed me in the right direction, though I still have problems, I'll edit the question with my progress.
    – Colin
    Nov 13, 2014 at 20:03

Well, I had to ditch xfce4-terminal, because keybindings were a nightmare, and go back to xterm. I actually prefer having several windows to tabs anyway, it turns out. Here is what I did for keybindings for xterm<-->bash

# ctrl-backspace

# meta-backspace

# ctrl-delete

# meta-delete
#  not detected

# ctrl-right-arrow

# ctrl-left-arrow

# meta-right-arrow

# meta-left-arrow

The only one I'm missing is meta-delete... what can you do.

  • Does Meta-d do what you want meta-delete to do?
    – l0st3d
    May 17, 2017 at 14:45

You must log in to answer this question.

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