Skip to content

Instantly share code, notes, and snippets.

@aclarknexient
Last active August 5, 2023 22:56
Show Gist options
  • Save aclarknexient/f9c5ce1ee029a1a36626a04533f5b940 to your computer and use it in GitHub Desktop.
Save aclarknexient/f9c5ce1ee029a1a36626a04533f5b940 to your computer and use it in GitHub Desktop.
Readline shortcuts

Readline Keyboard Shortcuts

Copied from the readline documentation.

For MacOS, replace Ctrl with Cmd, and Meta with Option.

Shortcut Comment
Ctrl+A Beginning of line
Ctrl+B / Backward one character
Meta+B Backward one word
Ctrl+C Send io.EOF
Ctrl+D Delete one character
Meta+D Delete one word
Ctrl+E End of line
Ctrl+F / Forward one character
Meta+F Forward one word
Ctrl+G Cancel1
Ctrl+H Delete previous character
Ctrl+I / Tab Command line completion
Ctrl+J Line feed
Ctrl+K Kill2 text to the end of line
Ctrl+Y Yank3 text back onto command line
Ctrl+L Clear screen
Ctrl+M Same as Enter key
Ctrl+N / Next line (in history)
Ctrl+P / Prev line (in history)
Ctrl+R Search backwards in history
Ctrl+S Search forwards in history
Ctrl+T Transpose characters
Meta+T Transpose words
Ctrl+U Kill text to the beginning of line
Ctrl+W Kill previous word
Backspace Delete previous character
Meta+Backspace Kill previous word
Enter Line feed
Ctrl+_ Undo edits

Footnotes

  1. Same as Escape

  2. Killing text means to delete the text from the line, but to save it away for later use, usually by yanking (re-inserting) it back into the line. (‘Cut’ and ‘paste’ are more recent jargon for ‘kill’ and ‘yank’.)

  3. Yanking means to copy the most-recently-killed text from the kill buffer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment