Bash Key Bindings Related to Auto-Completion
Bash Emacs Mode Completion Key Bindings
| Key Binding | Command | Description | Default Binding? |
|---|---|---|---|
| TAB | complete | Attempt to perform completion on the text before point. Bash tries variable, username, hostname, | Yes |
| or command completion, then filename completion if none match. | |||
| M-? | possible-completions | List the possible completions of the text before point. | Yes |
| M-* | insert-completions | Insert all completions of the text before point that would have been generated by | Yes |
| possible-completions. | |||
| menu-complete | menu-complete | Like complete, but cycles through possible completions, inserting each match in turn. | No |
| menu-complete-backward | menu-complete-backward | Like menu-complete, but cycles backward through the list of possible completions. | No |
| delete-char-or-list | delete-char-or-list | Deletes char under cursor, or if at end of line, behaves like possible-completions. | No |
| M-/ | complete-filename | Attempt filename completion on the text before point. | Yes |
| C-x / | possible-filename-completions | List the possible completions of the text before point, treating it as a filename. | Yes |
| M-~ | complete-username | Attempt completion on the text before point, treating it as a username. | Yes |
| C-x ~ | possible-username-completions | List the possible completions of the text before point, treating it as a username. | Yes |
| M-$ | complete-variable | Attempt completion on the text before point, treating it as a shell variable. | Yes |
| C-x $ | possible-variable-completions | List the possible completions of the text before point, treating it as a shell variable. | Yes |
| M-@ | complete-hostname | Attempt completion on the text before point, treating it as a hostname. | Yes |
| C-x @ | possible-hostname-completions | List the possible completions of the text before point, treating it as a hostname. | Yes |
| M-! | complete-command | Attempt completion on the text before point, treating it as a command name. | Yes |
| C-x ! | possible-command-completions | List the possible completions of the text before point, treating it as a command name. | Yes |
| M-TAB | dynamic-complete-history | Attempt completion on the text before point, comparing the text against lines from the history | Yes |
| list for possible completion matches. | |||
| dabbrev-expand | dabbrev-expand | Attempt menu completion on the text before point, comparing the text against lines from the | No |
| history list for possible completion matches. | |||
| M-{ | complete-into-braces | Perform filename completion and insert the list of possible completions enclosed within braces | Yes |
| so the list is available to the shell. |
Legend
- `M-` = Meta (usually Alt or Esc)
- `C-` = Control
- "No" in "Default Binding?" means the command is unbound by default and must be bound manually in `.inputrc` if desired.
Notes
- Some commands (like `menu-complete`, `menu-complete-backward`, `delete-char-or-list`, and `dabbrev-expand`) are unbound by default.
- You can bind unbound commands in your `~/.inputrc` for even more powerful completion workflows.