0

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?

marked as duplicate by Gilles, Renan, Stéphane Gimenez, Ulrich Dangel, jasonwryan Aug 23 '12 at 1:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

migrated from serverfault.com Apr 26 '12 at 16:30

This question came from our site for system and network administrators.

1

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.