You’d like to adjust the way bash handles input, especially command completion. For example, you’d like it to be case-insensitive.
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):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# 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 completions instead of ringing bell set show-all-if-ambiguous on # From the readline documentation at # http://tiswww.tis.case.edu/php/chet/readline/readline.html#SEC12 # Macros that are convenient for shell interaction # edit the path "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f" # prepare to type a quoted word -- insert open and close double quotes # and move to just after the open quote "\C-x\"": "\"\"\C-b" # insert a backslash (testing backslash escapes in sequences and macros) "\C-x\\": "\\" # Quote the current or previous word "\C-xq": "\eb\"\ef\"" # Add a binding to refresh the line, which is unbound "\C-xr": redraw-current-line # Edit variable on current line. #"\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y=" "\C-xe": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y=" $endif |
You will want to experiment with these and other settings. Also note the $include to use thesystem settings, but make sure you can change them if you like.
Many people are not aware of how customizable, not to mention powerful and flexible, the GNU Readline library is.
Having said that, there is no “one size fits all” approach. You should work out a configuration that suits your needs and habits.
Note the first time readline is called it performs its normal startup file processing, including looking at $INPUTRC, or defaulting to ~/.inputrc if that’s not set.