How to move the cursor word by word in the OS X Terminal

Out of the box you can use the quite bizarre Esc+F to move to the beginning of the next word and Esc+B to move to the beginning of the current word.


On macOS (all versions) the following keyboard shortcuts work by default.

  • ALT+F to jump Forward by a word.
  • ALT+B to jump Backward by a word.

Note that you have to make set the Option key to act like the Meta key. You can do this in Terminal by accessing preferences (CMD+,) and selecting Profiles -> Keyboard. In iTerm2 Pselect rofiles -> Keys -> General and select "Option key as Esc+."

Terminal and iTerm2 Preference Screens

Additionally some Emacs-style key bindings for simple text navigation seem to work on bash shells. You can use:

  • CTRL+F to move forward by a char
  • CTRL+B to move backward by a char
  • CTRL+A to jump to start of the line
  • CTRL+E to jump to end of the line
  • CTRL+K to kill the line starting from the cursor position
  • ALT+D to delete a word starting from the current cursor position
  • CTRL+W to remove the word backwards from cursor position
  • CTRL+Y to paste text from the kill buffer
  • CTRL+R to reverse search for commands you typed in the past from your history.
  • CTRL+S to forward search (works in ZSH for me but not bash)