Can the command completion for `cd` be modified to only show directories and ignore files?
When I am in a directory in bash, and I press
cd Space Tab, it shows everything in the directory as a possibility. (
Show all 1000 possibilities?) This is really cumbersome when I am in a directory with lots of regular files and relatively few directories.
So, is it possible to make the choices for autocompletion of
cd to only include directories?
I know I can get a directory listing within a directory by doing
ls -d */
but I’m not sure how to proceed from there.
I am using CentOS 6.6 Final.
complete -d cd
~/.bashrc (or other bash configuration file).
This should be happening automatically on a typical install on many distros.
If it is not, you’re probably missing the
sudo apt-get install bash-completion
sudo pacman -S bash-completion