How to Move the Cursor in Mac OS X Terminal (Bash)

Posted by on Mar 29, 2011 in Geek, How To | No Comments

Moving around the terminal one character at a time is slow and gets annoying, so here’s how to move around word by word:

ctrl-a: move to front of line
ctrl-e: move to end of line
ctrl-w: delete word before cursor

 

By default, the shortcuts for moving left and right are Esc-b and Esc-f. It’s much handier to use Alt/Option-left and -right, so this is how you can configure terminal to do that:

To configure it to Alt + left and right:
 - Open Terminal preferences (command + ,);
 - At Keyboard tab, select "control cursor left (or right)" and doubleclick it;
      - Left: Select the combo "modifier" to "option" and the action to 33b
      - Right: Select the combo "modifier" to "option" and the action to 33f

 

Sources:

http://www.infoentropy.com/terminal_window_keyboard_shortcuts_mac_linux

http://snipplr.com/view/28113/config-terminal-to-move-wordbyword/