How to move one word right/left in linux/bash?
- Alt+F moves forward, and
- Alt+B moves backwards.
But that's not all!
- Ctrl+A moves to the beginning of the line,
- Ctrl+E moves to the end of the line,
- Ctrl+R performs an interactive history search, which is very useful.
For many more keybindings, comb your way through man bash
.
Add these two lines to your ~/.inputrc
file:
"\eOC": forward-word
"\eOD": backward-word
and press Ctrl-x Ctrl-r to reread the file to make the changes active in your current session.
You will be able to use Ctrl-Right and Ctrl-Left to move right or left word by word.