up vote 8 down vote favorite
7
share [g+] share [fb]

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.

link|improve this question

20% accept rate
feedback

2 Answers

up vote 9 down vote accepted

Add these two lines to your ~/.inputrc file:

"\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.

link|improve this answer
1  
+1 very cool feature – whitequark Jan 31 '10 at 23:42
Would a similar trick work for deleting whole words? – Casebash Nov 1 '11 at 4:00
@Casebash: Try bind -P | grep kill-word to show you the existing key bindings for deleting whole words. You can change the bindings in a similar manner to my answer above, if needed. – Dennis Williamson Nov 2 '11 at 15:46
feedback

For the Linux console:

"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert

7.7. Creating the /etc/inputrc File

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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