A few of these programs :
By default, the end user interface of readline comes with really interesting keybindings. They are documented but the page layout is not really user-friendly so here's a summary :
| Type | Name | Emacs shortcut | Action | Object | Direction | Equivalent Windows/Gnome/KDE |
|---|---|---|---|---|---|---|
| Mode | emacs-editing-mode | ^ Ctrl+e | Change | mode | from vi to emacs (set -o emacs) | |
| vi-editing-mode | ^ Ctrl+⎇ Alt+j | Change | mode | from emacs to vi (set -o vi) | ||
| Move | backward-char | ^ Ctrl+b | Move the cursor | one character | to the left | ← |
| forward-char | ^ Ctrl+f | Move the cursor | one character | to the right | → | |
| backward-word | ⎇ Alt+b | Move the cursor | one word | to the left | ^ Ctrl+← | |
| forward-word | ⎇ Alt+f | Move the cursor | one word | to the right | ^ Ctrl+→ | |
| beginning-of-line | ^ Ctrl+a | Move the cursor | to the start of the line | |||
| end-of-line | ^ Ctrl+e | Move the cursor | to the end of the line | |||
| exchange-point-and-mark | ^ Ctrl+x ^ Ctrl+x | Move the cursor | to the start of the line/to original position | |||
| Swap | transpose-char | ^ Ctrl+t | Swap | the character | before the cursor with current position | |
| transpose-word | ⎇ Alt+t | Swap | the word | before the cursor with current word | ||
| Search | character-search | ^ Ctrl+] | Search | the character | and move to next occurence | |
| character-search-backward | ^ Ctrl+⎇ Alt+] | Search | the word | and move to previous occurence | ||
| Case | downcase-word | ⎇ Alt+l | Lowercase | the word | from cursor | |
| upcase-word | ⎇ Alt+u | Uppercase | the word | from cursor | ||
| capitalize-word | ⎇ Alt+c | Capitalize | the word | from cursor | ||
| Kill | delete-char | ^ Ctrl+d | Delete | the character | ||
| unix-word-rubout | ^ Ctrl+w | Delete | the word | left until after the previous word boundary | ||
| backward-kill-word | ⎇ Alt+⌫ Backspace | Delete | the word | |||
| kill-word | ⎇ Alt+d | Delete | the word | right until before the next word boundary | ||
| unix-line-discard | ^ Ctrl+u | Delete | everything | from the cursor to the start of the line | ||
| kill-line | ^ Ctrl+k | Delete | everything | from the cursor to the end of the line | ||
| Yank | yank | ^ Ctrl+y | Yank | the kill ring | at point | |
| yank-pop | ⎇ Alt+y | Yank | the kill ring | at point (going through older content) | ||
| Undo | undo | ^ Ctrl+_ (or ^ Ctrl+x ^ Ctrl+u) | Undo | last change | ||
| revert-line | ⎇ Alt+r | Undo | all changes | made to this line | ||
| Completion | complete | ↹ Tab | Attempt completion | |||
| possible-completions | ⎇ Alt+? | List completions | ||||
| insert-completions | ⎇ Alt+* | Insert completions | ||||
| History | previous-history | ^ Ctrl+p | Move in history | one line | up | |
| next-history | ^ Ctrl+n | Move in history | one line | down | ||
| beginning-of-history | ⎇ Alt+< | Move in history | all lines | to the top | ||
| end-of-history | ⎇ Alt+> | Move in history | all lines | to the bottom | ||
| reverse-search-history | ^ Ctrl+r | Incremental search | backward, going up the history | |||
| forward-search-history | ^ Ctrl+s | Incremental search | forward, going down the history | |||
| ^ Ctrl+j | Stop | incremental search | ||||
| abort | ^ Ctrl+g | Stop | incremental search | and restore original line | ||
| non-incremental-reverse-search-history | ⎇ Alt+p | Non-incremental search | backward, going up the history | |||
| non-incremental-forward-search-history | ⎇ Alt+n | Non-incremental search | forward, going down the history | |||
| yank-nth-arg | ^ Ctrl+⎇ Alt+y | Yank | first argument | of the previous command | ||
| yank-last-arg | ⎇ Alt+. or ⎇ Alt+_ | Yank | last argument | of the previous command | ||
| Refresh | clear-screen | ^ Ctrl+l | Clear | the screen | ||
| redraw-current-line | None | Refresh | the current line |
⎇ Alt is also called "meta" prefix and written "M-" or "\M-".
^ Ctrl is also called "control" prefix and written "C-" or "\C-".
Loose convention is that Control operates on characters while Meta operates on words.
Numeric arguments can be passed to readline commands. Type meta digits (⎇ Alt+digit, digit can be - for negative arguments) and then the command. Once the first meta digit is typed, the reminder (if any) can be typed normally. For instance, ⎇ Alt+1, 0, ^ Ctrl+d will delete the next 10 characters.
Numeric arguments can also be used to repeat normal inputs. For instance, ⎇ Alt+1, 0, k inserts "kkkkkkkkkk". If the input is a digit, ^ Ctrl+v can be used to insert it : ⎇ Alt+1, 0, ^ Ctrl+v, 2 inserts "2222222222".
These bindings can be changed with a configuration file called
inputrc.Also, in Bash, the
bind builtin command can be used to display (bind -P) or modify the readline key bindings. The read builtin command can be used to see the string corresponding to special key inputs. For instance, F5 gives "^[[15~" and then bind '"\e[15~":"top\C-m"' would map F5 to "top\n"