(转自stackoverflow,略改)
On Mac OS X 10.7 – the following keyboard shortcuts work by default.
- Meta-Right to jump forward by a word
- Meta-Left to jump backward by a word
I have observed that default emacs key-bindings for simple text navigation seem to work on bash shells. You can use
- Meta-d to delete a word starting from the current cursor position
- 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
- 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)
- Ctrl-f to move forward by a char
- Ctrl-b to move backward by a char