Ubuntu – Putty SSH: CTRL+Cursor keys don’t work skip to previous/next word

bashinputrcputtyshellUbuntu

When I am connected to my local Ubuntu dev server with putty (from my Windows 7 box) via SSH, the following key combinations don't work to move the cursor forward and backward on word boundaries:

  • Ctrl+Left Arrow on the cursor pad
  • Ctrl+Right Arrow on the cursor pad

The cursor only moves one character at a time. I'm using bash.

Best Answer

Add these two lines to your ~/.inputrc file on the destination machine:

"\eOD": backward-word
"\eOC": forward-word

To make sure that they are the correct sequences, at a Bash prompt, type Ctrl-V Ctrl-LeftArrow and Ctrl-V Ctrl-RightArrow, you should see:

^[OD^[OC

When you start a new session, the keys will be available or you can press Ctrl-xCtrl-r to re-read the ~/.inputrc file for the current session.