Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

4 Answers 4

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
share|improve this answer

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

share|improve this answer
    
Thanks for the official name (adding it to question title) –  Vagnerr Sep 23 '09 at 16:10
    
How does this answer the question? –  shantnu Oct 8 at 13:21
    
@shantnu We were young. Mistakes were made. –  Annika Backstrom Oct 8 at 18:19

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.

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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