Some of my favorite console shortcuts
These all work on an emacs-style (set -o emacs) readline linked against shell interpreters (BaSH, ZSH, etc). (There are some that work a bit differently on ZSH):
Of course, all these come almost unchanged from EMACS.
- C-F Move to next character
- C-B Move to previous character
- C-A Jump to beginning of line (bol)
- C-E Jump to end of line (eol)
- M-B Jump to previous word
- M-F Jump to next word
- C-/ Undo
- C-X C-X Swap point. There are two marks. You can move around, C-X C-X, move some more, and then switch between points.
- C-X C-E Edit command in $EDITOR (for zsh, see here)
M-. / M-_ Recall the last argument of the last command (and keep going back in history)
C-K Kill line from point to eol
C-U Kill line from point to bol
M-D Kill next word
M-Backspace Kill previous word
C-W Kill previous word (to previous space)
C-H Kill previous character (doesn't go into kill ring)
C-D Kill next character (doesn't go into kill ring)
C-Y Yank killed text
C-R Recall text backward
C-S Recall text forward (might not work depending on terminal settings. It could stop flow. If this happens, C-Q restores it)
history Show history
Written by Juan C. Muller
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#