Move the Cursor One Word in Terminal (Alt+F / Alt+B)
Press Alt+F to move the cursor forward one word and Alt+B to move it back one word on the command line. On Mac Terminal enable "Use Option as Meta key". Works in bash and zsh on Mac, Linux and WSL.
| Action | Mac | Windows | |
|---|---|---|---|
| Move forward one word | Option+F | Alt+F | |
| Move back one word | Option+B | Alt+B | |
| Move to start of line | Ctrl+A | Ctrl+A | |
| Move to end of line | Ctrl+E | Ctrl+E |
Jump word by word
Press Alt+F to move the cursor forward one word and Alt+B to move it back one word, instead of holding the arrow keys. It works in bash and zsh on Linux and Windows WSL / Git Bash.
On macOS: enable Option as Meta
By default the Option key types accented characters. In Terminal go to Settings → Profiles → Keyboard and tick "Use Option as Meta key"; in iTerm2 set the Left Option key to Esc+. Then Option+F and Option+B jump by word.
Related word shortcuts
Combine these with Ctrl+A / Ctrl+E to jump to the start or end of the whole line, and Ctrl+W to delete the previous word.
FAQ
How do I move the cursor one word at a time in the terminal?
Press Alt+F to go forward one word and Alt+B to go back one word. On Mac enable Use Option as Meta key, then use Option+F and Option+B.
Why does Option+F type a symbol on my Mac?
By default Option is a compose key. In Terminal enable Use Option as Meta key under Settings → Profiles → Keyboard, or set Option to Esc+ in iTerm2.
Is there a Ctrl version of move-by-word?
Readline's standard word-motion bindings use the Meta (Alt/Option) key. Some terminals also map Ctrl+Left / Ctrl+Right to the same forward-word / backward-word actions.
Do Alt+F / Alt+B work in zsh?
Yes, zsh binds them to forward-word and backward-word by default, the same as bash.