Possible Duplicate:
How to change previous/next word shortcut in bash?

When connected to a ubuntu server bash shell, I can hold alt key and press the left or right keys to move forward or backward a word. It is incredibly useful.

Is this behaviour defined in the .bash_profile or can it be? I.e. can I bring this behaviour into my OSX shell?


Put this into your ~/.bash_profile:

bind '"\M-\e[C":forward-word'
bind '"\M-\e[D":backward-word'

Checked on OS X Lion.

  • I can't get this to work... could I be missing something else? – Ross May 2 '12 at 14:36
  • Can you paste here output of this command: fgrep ard-word $HOME/.${SHELL##*/}_profile? – Rudolf Adamkovic May 2 '12 at 18:25

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