gnu readline

 many cli apps use libreadline Bash, GDB, Python REPL, sqlite3 

Movement

Shortcut (Emacs)Action
Ctrl + aMove to the beginning of the line
Ctrl + eMove to the end of the line
Ctrl + fMove forward one character (equivalent to Right Arrow)
Ctrl + bMove backward one character (equivalent to Left Arrow)
Alt + fMove forward one word
Alt + bMove backward one word
Ctrl + x, Ctrl + xToggle cursor position between current location and start of line

Cutting, Deleting & Pasting (Yanking)

Shortcut (Emacs)Action
Ctrl + dDelete character under the cursor (or exit shell on empty line)
Backspace / Ctrl + hDelete character before the cursor
Alt + BackspaceDelete word before the cursor
Alt + dDelete word after the cursor
Ctrl + kCut (kill) text from cursor to end of line
Ctrl + uCut (kill) text from cursor to beginning of line
Ctrl + wCut (kill) previous whitespace-delimited word
Alt + \Delete all spaces/tabs around the cursor
Ctrl + yPaste (yank) top item from the kill ring
Alt + yCycle through previous items in the kill ring (after pressing Ctrl + y)

History Navigation

Shortcut (Emacs)Action
Ctrl + rIncremental backward search through command history
Ctrl + sIncremental forward search (may require stty -ixon to disable flow control)
Ctrl + pMove to previous history entry (Up Arrow)
Ctrl + nMove 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
TabAutocomplete command/path
Alt + ?List possible completions without expanding
Alt + *Insert all possible completions directly onto the command line
Ctrl + lClear terminal screen (preserves current line input)
Ctrl + tTranspose (swap) character under cursor with preceding character
Alt + tTranspose (swap) word under cursor with preceding word
Alt + uUppercase word from cursor to end of word
Alt + lLowercase word from cursor to end of word
Alt + cCapitalize character at cursor and move to end of word
Ctrl + _ or Ctrl + x, Ctrl + uUndo 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