Types of key bindings
- navigate
- edit
- control
- recall
Modifier keys
-
C-: Ctrl
-
M-: Meta is usually the Alt key on most keyboards, and possibly Esc on Mac computers
Key bindings
key binding | description | type | comment | |
---|---|---|---|---|
C-f | move forward one character | edit | ||
C-b | move backward one character | edit | ||
C-a | move cursor to the beginning of the line | navigate | ||
C-e | move cursor to the end of the line | navigate | ||
M-b | move cursor backward to the beginning of word | navigate | ||
M-f | move cursor forward to the end of word | navigate | ||
C-x C-x | move cusor between the two most recent cursor positions | navigate | ||
C-u | delete backwards from cursor to the beginning of the line | edit | ||
C-k | delete forwards from cursor to the end of the line | edit | ||
C-w | delete backwards from cursor to beginning of word | edit | ||
M-d | delete forwards from cursor to end of word | edit | Use Esc on macOS. | |
C-h | delete backwards a character | edit | ||
C-d | delete forwards a character | edit | ||
C-y | paste text that was cut | edit | ||
M-c | capitalize from cursor to end of word | edit | ||
M-u | make uppercase from cursor to end of word | edit | ||
M-l | make lowercase from cursor to end of word | edit | ||
M-t | swap current word with previous | edit | ||
C-t | swap character under cursor with the previous one | edit | ||
C-_ | undo | edit | ||
C-l | clear the screen | control | ||
C-s | stop output to the screen (for long running verbose command) | control | ||
C-q | allow output to the screen (if previously stopped using command above) | control | ||
C-c | terminate the command | control | ||
C-z | suspend/stop the command | control | type bg to put the command at
background |
|
C-r | search the history backwards | recall | ||
C-g | escape from history searching mode | recall | ||
C-p | previous command in history | recall | ||
C-n | next command in history | recall | ||
M-. | use the last word of the previous command | recall | ||
!! |
run last command | recall | ||
!foobar |
run the most recent command that starts with
foobar |
recall | e.g. !ls |
|
!foobar:p |
print out the most recent command that starts with
foobar |
recall | ||
!$ |
run the last word of the previous command as a command | recall | same as M-. | |
!$:p |
print the last word of the previous command | recall | ||
!* |
run the previous command except for the last word as a command | recall | ||
!*:p |
print the previous command except for the last word | recall |