Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

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?

share|improve this question

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

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

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.

Put this into your ~/.bash_profile:

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

Checked on OS X Lion.

share|improve this answer
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.