Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to move left and right by words using ctrl + left/right arrow in terminal (I'm on ubuntu 12.10). Currently when I use these keystrokes I get ;5D or ;5C appended onto the line, which is useless for me.

share|improve this question

Use Escb to go backward and Escf to go forward.


share|improve this answer
Thank you, those keystrokes work for me, but do you know any way to bind the ctrl + left/right arrow to do the same thing - perhaps by editing in .bashrc file something? – wim Dec 21 '12 at 1:46
Don't know exactly. Start researching the bind command – glenn jackman Dec 21 '12 at 11:42
up vote 1 down vote accepted

glenn jackman's answer above pointed me in the right direction, and I've figured it out - add the following lines into file ~/.inputrc:

# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
"\e[1;5C": forward-word
"\e[1;5D": backward-word
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
share|improve this answer

You must log in to answer this question.

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