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

  1. Is there a way to turn this feature off (just dumbly complete to any file regardless).
  2. How do you adjust the extensions that are valid for a particular command.

Thanks

Peter

link|improve this question
feedback

3 Answers

up vote 1 down vote accepted

comment out these lines in /etc/bash.bashrc (it may be in ~/.bashrc):

if [ -f /etc/bash_completion ]; then
 . /etc/bash_completion
fi
link|improve this answer
feedback

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

link|improve this answer
Thanks for the official name (adding it to question title) – Vagnerr Sep 23 '09 at 16:10
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.