Skip to content

Terminal Keyboard Shortcuts Cheat Sheet

Terminal shortcuts (mostly based on Emacs mode, the default for most Shells) can significantly increase command-line efficiency.

Cursor Movement

Shortcut Description
Ctrl + A Move cursor to beginning of line
Ctrl + E Move cursor to end of line
Alt + F Move cursor forward one word
Alt + B Move cursor backward one word
Ctrl + F Move cursor forward one character
Ctrl + B Move cursor backward one character
Ctrl + XX Quickly jump between beginning of line and current cursor position

Text Editing

Shortcut Description
Ctrl + U Cut/Delete from cursor to beginning of line
Ctrl + K Cut/Delete from cursor to end of line
Ctrl + W Cut/Delete one word before cursor
Alt + D Cut/Delete one word after cursor
Ctrl + Y Paste last cut content (Yank)
Ctrl + H Delete character before cursor (Backspace)
Ctrl + D Delete character after cursor (Exit terminal if no text)
Ctrl + _ Undo last edit
Ctrl + T Transpose two characters before and after cursor

Process Control

Shortcut Description
Ctrl + C Terminate currently running process (SIGINT)
Ctrl + Z Suspend current process to background (SIGTSTP)
Ctrl + D Send EOF, usually exits current Shell or ends input
Ctrl + S Stop output to screen (Screen lock)
Ctrl + Q Resume screen output
Ctrl + \ Exit current process and core dump (SIGQUIT)

History and Search

Shortcut Description
Ctrl + R Search history commands (Incremental search)
Ctrl + G Exit search mode
Ctrl + P Previous command (Up arrow)
Ctrl + N Next command (Down arrow)
!! Execute last command
!string Execute last command starting with string
!* Reference all arguments of last command
!$ Reference last argument of last command

Screen Control

Shortcut Description
Ctrl + L Clear screen (Same as ‘clear’)
Ctrl + S Freeze terminal (Stop accepting input)
Ctrl + Q Unfreeze terminal