Bash

1 character

  • C-f (forward-char)

  • C-b (backward-char)

  • C-d (delete-char) delete character at point

  • <DEL> (backward-delete-char) delete the character behind (before) the cursor

2 completion

  • <TAB> (complete)

  • M-? (possible-completions) list possible completions

  • M-* (insert-completions) insert all completions generated by M-?

  • M-/ (complete-filename)

  • C-x / (possible-filename-completions)

  • M-! (complete-command)

  • C-x ! (possible-command-completions)

  • M-<TAB> (dynamic-complete-history)

3 history

  • C-p (previous-history)

  • C-n (next-history)

  • C-r (reverse-search-history)

  • C-s (forward-search-history)

  • M-C-y (yank-nth-arg) insert the first argument from the previous command

  • M-1 M-C-y insert the second argument from the previous command

  • M-. (yank-last-arg) insert the last argument from the previous command

  • M-1 M-. insert the second to last from the previous command

4 line

  • C-a (beginning-of-line)

  • C-e (end-of-line)

  • C-k (kill-line) kill from the point to the end of the line

  • C-x <DEL> (backward-kill-line) kill from the point to the beginning of the line

5 misc

  • C-l (clear-screen)

  • (redraw-current-line)

  • C-x C-r (re-read-init-file)

  • C-g (abort) abort the current editing command and ring the terminal bell

  • C-x C-u (undo) incremental undo per line

  • C-x C-v (display-shell-version)

6 Startup Files

  • .bash_profile is for a login-shell. Commands that need to run only once go in this file (eg. setting paths)

  • .bashrc is for a non-login-shell. Commands that should run every time when bash is called go in this file. (eg. abbreviations and custom functions)

7 word

  • M-f (forward-word)

  • M-b (backward-word)

  • M-d (kill-word) kill from the point to the end of the current (or next) word

  • M-<DEL> (backward-kill-word) kill the word behind point