A collection of bash shortcuts that I tend to forget. (Why do I still use ctrl + s
as my tmux leader key?)
Mostly applies to zsh as well.
Source (slightly adapted and WIP): https://gist.github.com/tuxfight3r/60051ac67c5f0445efee
non-bash-specific
key combo | action |
---|
ctrl + s | suspend output |
ctrl + q | resume output |
ctrl + c | kill running process |
ctrl + l | clear screen |
ctrl + z | background current process |
movement
key combo | action |
---|
ctrl + a | go to beginning of line |
ctrl + e | go to end of line |
ctrl + b | back one char |
ctrl + f | forward one char |
alt + b | back one word |
alt + f | forward one word |
ctrl + xx | toggle between line start and current position |
editing
key combo | action |
---|
ctrl + d | delete char under cursor |
ctrl + h | delete char before cursor |
ctrl + u | cut before cursor |
ctrl + k | cut after cursor |
ctrl + w | delete word before cursor |
alt + d | delete word after cursor |
ctrl + y | paste |
ctrl + _ | undo |
alt + backspace | delete previous word |
ctrl + t | swap last two chars before cursor |
esc + t | swap last two words before cursor |
history
key combo | action |
---|
alt + < | move to first line in history |
alt + > | move to last line in history |
ctrl + r | reverse search history |
ctrl + p | fetch previous command (up arrow) |
ctrl + n | fetch next command (down arrow) |
!! | last command in history |
!vi | last command beginning with vi |
!vi:p | print last command beginning with vi |
!n | execute nth command in history |
!$ | last argument of last command |
!^ | first argument of last command |
^abc^xyz | replace first occurrence of abc with xyz in last command and execute |