All commands below assume bash is configured in emacs mode:
set -o emacsReference:
- C-a : Go to the beginning of the line ()
- C-e : Go to the End of the line ()
- C-p : Previous command ()
- C-n : Next command ()
- C-b : Backward one character ()
- C-f : Forward one character ()
- M-b : Back (left) one word (C-)
- M-f : Forward (right) one word (C-)
- C-x C-x : Toggle between the start of line and current cursor position
Terminology:
- Word: Set of characters. Limited by special characters (e.g.,
/.,). - Term: Compound of words. Limited by spaces.
- Delete: String is deleted.
- Kill: String is deleted and added to clipboard.
- Yank: Paste.
Unless specified otherwise, actions start at the cursor position.
- C-x C-e : Edit in
$VISUAL. - C-/ : Undo.
- C-y : Yank.
- M-y : Rotate the kill-ring (after yank).
- : Complete.
- C-d : Delete character under cursor.
- C-h : Delete character before cursor ().
- M- : Kill word before.
- M-d : Kill word after.
- C-w : Kill term before.
- C-u : Kill line before.
- C-k : Kill line after.
- M-t : Swap word with previous.
- C-t : Swap last two characters before the cursor.
- + t : Swap two previous words.
- M-u : Upcase word after.
- M-l : Downcase word after.
- M-c : Capitalize character and move to end of word.
- M-r : Cancel the changes and put back the line as it was in the history (revert).
- C-l : Clear the screen
- C-d : Close shell.
- C-s : Disable output to the screen.
- C-q : Enable output to the screen.
- C-c : Send
SIGINTsignal, to interrupt (abort) process. - C-z : Send
SIGTSTPsignal, to stop (suspend) process. Usefg <name>to recover.