gnu readline
many cli apps use libreadline Bash, GDB, Python REPL, sqlite3
Movement
| Shortcut (Emacs) | Action |
| Ctrl + a | Move to the beginning of the line |
| Ctrl + e | Move to the end of the line |
| Ctrl + f | Move forward one character (equivalent to Right Arrow) |
| Ctrl + b | Move backward one character (equivalent to Left Arrow) |
| Alt + f | Move forward one word |
| Alt + b | Move backward one word |
| Ctrl + x, Ctrl + x | Toggle cursor position between current location and start of line |
Cutting, Deleting & Pasting (Yanking)
| Shortcut (Emacs) | Action |
Ctrl + d | Delete character under the cursor (or exit shell on empty line) |
Backspace / Ctrl + h | Delete character before the cursor |
Alt + Backspace | Delete word before the cursor |
Alt + d | Delete word after the cursor |
Ctrl + k | Cut (kill) text from cursor to end of line |
Ctrl + u | Cut (kill) text from cursor to beginning of line |
Ctrl + w | Cut (kill) previous whitespace-delimited word |
Alt + \ | Delete all spaces/tabs around the cursor |
Ctrl + y | Paste (yank) top item from the kill ring |
Alt + y | Cycle through previous items in the kill ring (after pressing Ctrl + y) |
History Navigation
| Shortcut (Emacs) | Action |
| Ctrl + r | Incremental backward search through command history |
| Ctrl + s | Incremental forward search (may require stty -ixon to disable flow control) |
| Ctrl + p | Move to previous history entry (Up Arrow) |
| Ctrl + n | Move to next history entry (Down Arrow) |
Alt + . or Alt + _ | Insert last argument of previous command |
| Alt + < | Move to first entry in history |
| Alt + > | Move to last entry in history |
Completion & Macro Tricks
| Shortcut (Emacs) | Action |
| Tab | Autocomplete command/path |
| Alt + ? | List possible completions without expanding |
| Alt + * | Insert all possible completions directly onto the command line |
| Ctrl + l | Clear terminal screen (preserves current line input) |
| Ctrl + t | Transpose (swap) character under cursor with preceding character |
| Alt + t | Transpose (swap) word under cursor with preceding word |
| Alt + u | Uppercase word from cursor to end of word |
| Alt + l | Lowercase word from cursor to end of word |
| Alt + c | Capitalize character at cursor and move to end of word |
Ctrl + _ or Ctrl + x, Ctrl + u | Undo last editing action |
config
~/.inputrc
set completion-ignore-case on
set completion-map-case on
set show-all-if-ambiguous on
set colored-stats on
set visible-stats on
set completion-query-items 200
set bell-style none
set horizontal-scroll-mode off
"\e[A": history-search-backward
"\e[B": history-search-forward
src
https://tiswww.case.edu/php/chet/readline/rltop.html