Skip to content

Instantly share code, notes, and snippets.

@dra1n
Last active April 10, 2026 14:11
Show Gist options
  • Select an option

  • Save dra1n/75bfa76182beb06aa243d7e42e9b7059 to your computer and use it in GitHub Desktop.

Select an option

Save dra1n/75bfa76182beb06aa243d7e42e9b7059 to your computer and use it in GitHub Desktop.

Command Line Navigation Cheat Sheet

Alt key may need to be Esc on macOS depending on your terminal settings.

Cursor Movement

Shortcut Action
Ctrl+A Move to beginning of line
Ctrl+E Move to end of line
Ctrl+F Move forward one character
Ctrl+B Move backward one character
Alt+F Move forward one word
Alt+B Move backward one word

Deletion

Shortcut Action
Ctrl+D Delete character under cursor
Backspace Delete character before cursor
Ctrl+H Same as Backspace
Alt+D Delete word forward
Ctrl+W Delete word backward
Ctrl+K Delete from cursor to end of line
Ctrl+U Delete from cursor to beginning of line
Ctrl+Y Paste (yank) last deleted text

History

Shortcut Action
Ctrl+P / Previous command
Ctrl+N / Next command
Ctrl+R Reverse search history
Ctrl+G Cancel history search
!! Repeat last command
!$ Last argument of previous command

Process Control

Shortcut Action
Ctrl+C Kill current process
Ctrl+Z Suspend current process
Ctrl+L Clear screen
Ctrl+D Exit shell (on empty line)

Other

Shortcut Action
Tab Autocomplete
Tab Tab Show all completions
Ctrl+XX Toggle between current pos and line start
Alt+. Insert last argument of previous command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment