Your /etc/bash_completion
file must be missing.
sudo apt-get install bash-completion
should solve all your problems.
Given that you already have lines uncommented in /etc/bash.bashrc
as Faheem Mitha and others pointed out, it should work now:
# enable bash completion in interactive shells
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
Reason: The bash-completion
package now has that file (/etc/bash_completion).
It used to be in the bash
package, but not any more.
info on package change
You want either:
insert-completions
ALT* for 'insert all completions'
With this, a dir containing files name 'aa ab ac ad'
ls a*
followed by alt + *
would complete to ls aa ab ac ad
Man page entry on binding:
insert-completions (M-*)
Insert all completions of the text before point that would have been generated by possible-completions.
glob-expand-word
On some systems the above will not work with wildchars, the following does work on such systems for me:
ctrlx, * (a two stroke combo)
Example:
I populated a dir with:
touch {a,b,c,d,e,f}{1,2,3,4,5,6,7,8,9,0}00{a,b,c,d,f,e}
I then ls *100*
followed by ctrl + x, *
, which turns my readline into:
ls a100a a100b a100c a100d a100e a100f b100a b100b b100c b100d b100e b100f c100a c100b c100c c100d c100e c100f d100a d100b d100c d100d d100e d100f e100a e100b e100c e100d e100e e100f f100a f100b f100c f100d f100e f100f
Man page entry for binding:
glob-expand-word (C-x *)
The word before point is treated as a pattern for pathname expansion, and the list of matching file names is inserted, replacing the word. If a numeric argument is supplied, a ‘*’ is appended before pathname expansion.
Man Page
Best Answer
Apparently
shopt -s direxpand
works with everything except the built-incd
. So I just addedalias xy=cd
to my profile, andxy
works just likecd
exceptdirexpand
works using TAB. (Who would have thought it would be so simple?)