How do I turn off or adjust the clever tab completion in Ubuntu (Programmable Completion)
When I am running various commands on the command line in Ubuntu and use tab-completion for files. The only files I am given are ones which have the appropriate extension for the command I am running. For example..
xmms <tab><tab>
would list all the mp3's in the current directory and not any jpegs.
Most of the time this is quite useful. But if the file you want happens to have an incorrect extension, or the extension is valid but the tab completion doesn't think it is then it won't list the file or complete to it. So
- Is there a way to turn this feature off (just dumbly complete to any file regardless).
- How do you adjust the extensions that are valid for a particular command.
Thanks
Peter
Solution 1:
comment out these lines in /etc/bash.bashrc
(it may be in ~/.bashrc
):
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
Solution 2:
This is called "Programmable Completion" in bash. Use <tab>
to attempt programmable completion, or use M-/
to attempt the default completion (usually files and directories). See also: http://spikeypillow.com/item/30/catid/4
Solution 3:
The most elegant way to disable programmable completion should be to add:
shopt -u progcomp
to your .bashrc file. For more details, see the official documentation about the shopt
command: http://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
Solution 4:
To change the completion behaviour, just edit /etc/bash_completion. Scroll down to where you find the list of programs and associated extensions. It should be pretty self-explanatory from there.