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
Written by Natansh Verma
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#