Adjusting readline Behavior Using .inputrc
Problem
You’d like to adjust the way bash handles input, especially command completion. For example, you’d like it to be case-insensitive.
Solution
Edit or create a ~/.inputrc or
/etc/inputrc file as appropriate. There are many parameters you can adjust to
your liking. To have readline use your file when it
initializes, set $INPUTRC
; for
example, set INPUTRC='~/.inputrc'
. To
re-read the file and apply or test after making changes, use bind-f
filename
.
We recommend you explore the bind command
and the readline documentation,
especially bind -v, bind -l, bind -s,
and bind -p
, though the
last one is rather long and cryptic.
Some useful settings for users from other environments, notably Windows, are (see the section “Readline Init File Syntax” in Appendix A):
# settings/inputrc: # readline settings # To re-read (and implement changes to this file) use: # bind -f $SETTINGS/inputrc # First, include any systemwide bindings and variable # assignments from /etc/inputrc # (fails silently if file doesn't exist) $include /etc/inputrc $if Bash # Ignore case when doing completion set completion-ignore-case on # Completed dir names have a slash appended set mark-directories on # Completed names which are symlinks to dirs have a slash appended set mark-symlinked-directories on # List ls -F for completion set visible-stats on # Cycle through ambiguous completions instead of list "\C-i": menu-complete # Set bell to audible set bell-style audible # List possible ...
Get bash Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.