Restricted tab-completion is annoying

Aurélien Naldi aurelien.naldi at
Thu Oct 11 08:03:03 UTC 2007

On 10/11/07, Aaron C. de Bruyn <ubuntu-devel-discuss at> wrote:
> Ok--I'm sorry, but none of what you said made any sense to me.
> > I don't see the point why filenames needs to be tab-completed on default, it
> > does it when it's necessary.
> I'm asking why tab-completion changed from allowing tab-completion of EVERY file to being restricted.
> It sounds like you are asking why it needs to be on at all.
> My response to that is that it is a feature that people like and use.  It's been that way for as long as I can remember.  At least 8 years.
> > Filenames does tab-complete on certain tasks and applications, depending on
> > what are you trying to accomplish?
> Is that a question or statement?
> Yes, you hit tab to complete certain commands and filenames.  It seems like Ubuntu is trying to be helpful by showing you only the things it thinks you need.
> > For example, certain applications that require an input needs to
> > tab-complete a filename on it's parameters (i.e. rsync), and
> > executable files like python, perl, ruby & bash scripts would need
> > tab-completion to execute.
> Yes, that is why there is tab completion--because there are so many Linux command that take filenames as parameters.
> > If you really want to autocomplete your filenames, you might as well make
> > your files executable,
> So you are saying I should chmod +x all my videos, pictures, and music files in order to use tab-completion.  That's an even worse solution.  They aren't executable files.  They are data files that need to be interpreted BY programs that I execute.
> > and lastly why do you think this is necessary?
> Why do I think what is necessary?  Tab completion?  Disabling the new restrictions to tab-completion?  Being able to use a feature that has been in bash forever but was recently (in my opinion) crippled?

I think you are completely misunderstanding each other here...

Aaron was writing about filename completion as in "mplayer filename"
NOT as in using "filename" as a command!!!

I would like also to add a few comments on bash_completion: as far as
I know it is disabled by default in /etc/bash.bashrc  (and BTW I
always enable it here, with a few other things and this gets in the
way when the ubuntu package introduces a new version of the config
file.. A solution like /etc/bash.bashrc.local (similar to vimrc.local)
would be great...)

Then the default .bashrc for the users enables it (and duplicates most
of /etc/bash.bashrc)
I do not really love this solution, but if you do not like this
behaviour, all you have to do is to comment out / delete a couple of
lines in your .bashrc :)

And to try to make you change your mind, here is why I love
bash_completion: as said earlier it has context-dependent completion:
- filenames with the expected extension only (which is your only
problem with it)
- options of many programs: mplayer, apt-get, makefiles...
- option-dependant filename completion: after "mplayer " it completes
only audio/video filenames but after "mplayer file.avi -sub " it
completes only subtitle filenames which is great...
 - very smart completion: hostnames after ssh thanks to the content of
your .ssh/knownhosts (which does not work with more recently added
hosts as the hostname is no more written explicitely...), package
names on apt-get --install  and even INSTALLED packages names on
apt-get --remove

So the question is: should it stop filtering filenames by extensions ?
I do not think so as having an extension is always helpfull as an hint
and a good practice even if they are much less relevant under linux. A
lot of program use them anyway: try to gunzip a file NOT name file.gz
for exemple... And mplayer (and others like totem) automatically
select a subtitle with the same filename than the currently played
video file (except the extension obviously).
I really think that you should use extensions (but not completely rely
on them) and have fun with a much smaller/smarter completion list in
bash ;)

Anyway some special way to ask bash to bypass the extension-filtering
in some cases would be great. Something like <shift><tab> maybe (sorry
if this already exists!).
This way you get a smart filter for most case and keep the completion
for your extension-less files ;)

PS: really sorry for such a long comment...

Aurélien Naldi

More information about the Ubuntu-devel-discuss mailing list