Terminal – Alt-Left to Skip Words Not Working

bashkeyboard shortcutsreadlineterminal

On a Debian Wheezy machine at previous job, I got used to Alt+Left and Alt+Right to skip between words on active command-line (in bash).

However, since at home I have upgraded to Jessie (Debian 8.0, testing branch) this does not work anymore: instead of skipping to previous word, Alt-Left prints something like D or [D. OTOH, if I open ssh and connect to my headless Debian Wheezy, it does work perfectly.

Furthermore, I just installed Fedora 20 in my new job and here the behavior is the same. This applies to bash, csh and ksh (started under env -i), as well as rxvt-unicode and xfce4-terminal, so it must be something outside these level.

Where else in the stack should I look to find the difference?

Best Answer

You probably had a local ~/.inputrc or global /etc/inputrc file defined that was lost on the upgrade. An easy fix is to create an ~/.inputrc file with the following lines:

## enable Alt-arrows 
"\e[1;3D": backward-word ### Alt left
"\e[1;3C": forward-word ### Alt right

Those will work with xterm and terminator and gnome-terminal but might need to be tweaked for other terminals. Unfortunately, each terminal emulator can use a different syntax. For some more details, see my answer here.

Related Question