Last Updated: February 25, 2016
·
1.002K
· natansh

Movement in Bash on Mac

For simple movement -

C-a : Move to the front
C-e : Move to the end

To set up per word movement, we need to set up the Meta key. Initially it is set up to use Esc, which isn't very helpful.

To do so in Terminal, go to Terminal > Preferences > Keyboard. Select use option as meta key.

In iTerm, go to iTerm > Preferences > Profiles > Keys. At the bottom, set the left option and right option keys to be +Esc.

Now, since the Meta key is mapped to Option,

M-f or Option-f : Move forward by a word
M-b or Option-b : Move backward by a word