Here are the shortcuts that will work in Terminal app.
Home: control + A
End: control + E
Next Word: esc, then f
Previous word: esc, then b
I like my shortcuts to be consistent across the most used applications: Chrome, Sublime Text 2 and iTerm. This way I don’t have to think about what application I’m in, and I can just hit the buttons.
I’ve set tab switch to option+command+left and option+command+right, home to command+left, and end to command+right and previous word to option+left, and next word to option+right. These shortcuts for the most part mimic the default behavior in Sublime Text 2 and other editors.
iTerm is a better alternative to Terminal app on Mac OS X. You can get it at iterm2.com.
Go to your iTerm and open preferences from the menu (iTerm-> Preferences) or by using command + , or ⌘ + , shortcuts. Open Profiles tab and click on Keys for the Default profile.
To set home — that is, to jump to the beginning of a line — press command+left and then select ‘Send Hex Code’ and enter value 001.
Repeat the same thing for end substituting shortcut with command+right and hex with 005.
To set up previous word shortcut, press down option+left and then select ‘Send Escape Sequence’ and enter b. For the next word option+right shortcut, enter f.
I don’t know why Terminal and iTerm by default have broken shortcuts. Maybe there is some history to it, but it seems like I’m not the only person who has encountered (and/or fixed) the issue:
- Love Your Terminal
- Fixing Home, End, Page Up, and Page Down in Leopard’s Terminal
- Skip to Next or Previous Word in iTerm Using Alt / Option + Left or Right Arrow Keys
- Become a Command Line Ninja With These Time-Saving Shortcuts
Microsoft MVP | Book and Course Author | Software Engineering Leader
To contact Azat, the main author of this blog, submit the contact form or schedule a call at clarity.fm/azat and we can go over your bugs, questions and career.