Bourne Again Shell Cheat Sheet
Herein shortcuts are using Alt
as the Meta
key. Shortcuts may be given numeric arguments.
Ctrl
+A
: Aft –– cursor back to start of line
Ctrl
+E
: End –– cursor to end of line
Ctrl
+L
: Less –– clear screen, only show current line at top
Ctrl
+F
: Forward –– to next character right of cursor
Ctrl
+B
: Back –– to next character left of cursor
Alt
+F
: Forward –– to next word right of cursor
Alt
+B
: Back –– to next word left of cursor
Ctrl
+@
: At –– set mark at cursor
Ctrl
+X
Ctrl
+X
: Jump –– swap mark and cursor
Ctrl
+]
: Search –– search for character right of cursor
Alt
+Ctrl
+]
: Search –– search for character left of cursor
TOC
Tab
: Tab –– auto-complete file and directory names
Ctrl
+D
: Delete –– delete character under cursor
Ctrl
+H
: Hack –– delete character left of cursor
Ctrl
+_
: Undo –– undo last line edit command
Ctrl
+K
: Kill –– cut from cursor to end of line
Ctrl
+U
: Unset –– cut from cursor to start of line
Ctrl
+Y
: Yank –– paste last cut text at cursor
Ctrl
+W
: Word –– cut from cursor to start of next word on left
Alt
+D
: Delete –– cut from cursor to end of next word on right
Alt
+Delete
: Delete –– cut from cursor to start of next word on left
Alt
+&
: Expand –– expand tilde to directory name
Ctrl
+T
: Transpose –– drag 2nd character left of the cursor to the right
Alt
+T
: Transpose –– drag word left of the cursor to the right
Alt
+U
: Uppercase –– change current or following word to uppercase
Alt
+L
: Lowercase –– change current or following word to lowercase
TOC
Ctrl
+R
: Reverse –– search command history, replace current line
Ctrl
+P
: Previous –– move back through command history
Ctrl
+N
: Next –– move forward through command history
TOC
Bash works closely with the underlying system to provide Job Control. Strictly speaking, these shortcuts are that of the terminal input/output system and not Bash.
Ctrl
+C
: Cancel –– SIGINT interrupt program, terminate process
Ctrl
+\
: Quit –– SIGQUIT dump core and quit program
Ctrl
+Z
: Zombie –– SIGTSTP suspend execution, put process in background
Ctrl
+T
: Tip –– SIGINFO show status information of process
Ctrl
+S
: Stop –– suspend output of process
Ctrl
+Q
: Queue –– resume output suspended by Stop
TOC
Ctrl
+X
(
: Start –– start recording macro
Ctrl
+X
)
: Stop –– stop recording macro
Ctrl
+X
E
: Execute –– execute macro
TOC