Show Menu

Better Bash Keyboard Shortcuts (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.


ctrl + a
go to start of line
ctrl + e
go to end of line
ctrl + xx
go to start of line, press again to go back to starting position
alt + b
go back one word
alt + f
go forward one word
ctrl + b
go back one character
ctrl + f
fo forward one character


ctrl + r
search history backward
ctrl + s
search history forward*
ctrl + g
quit search mode
ctrl + p
previous command (same as )
ctrl + n
next command (same as )
ctrl + o
run current command from history, then queue next command in history
alt + .
insert last word of previous command (addit­ional presses cycle back through history)
* ctrl + s by default will stop output from the shell, but this is a termin­al-­level feature which blocks this command from reaching the shell
* run
stty -ixon
to disable to terminal feature, place in
to make permanent


ctrl + l
clear screen
ctrl + s
pause screen output
ctrl + q
unpause screen output
ctrl + z
suspend program (use
to unsuspend)


alt + c
captialize to end of word (make current char uppercase, remainder of word lowercase)
alt + u
from cursor, uppercase to end of word
alt + l
from cursor, lowercase to end of word
alt + t
transpose word with previous word (space counts as the next word)
ctrl + _ OR ctrl + 7 OR ctrl +x ctrl + u
undo last edit (can be used repeat­edly)
ctrl + x ctrl + e
open the current command line in your editor*
* specify desired editor by setting $EDITOR or $VISUAL enviro­nment variables
* when editing the command line in vi-like editor, quit with
to avoid running the command, otherwise exit with
as usual
* the shell might not recognise a GUI editor properly, since some spawn the process and then exit


ctrl + u
from cursor, delete to start of line
ctrl + k
from cursor, delete to end of line
ctrl + w
from cursor, delete to start of word
alt + d
from cursor, delete to end of word
ctrl + d
delete current character (delete key)
ctrl + h
delete character before cursor (backs­pace)
ctrl + y
paste cut/de­leted text after cursor


run last whole command
run last command starting with "­foo­"
run last command containing foo
replaced with last word of previous command (same as
alt + .
but doesn't put the actual text)
replaced with all arguments of previous command
<bang cmd>:p
print what <bang cmd> would be replaced with/run
<bang cmd>:s­/fo­o/bar
replace foo with bar in command returned by <bang cmd> (use sed search­/re­place format)