Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For some strange reason my filename autocomplete is behaving differently than normal. Given the following file structure ./foobar/file.txt, if I want to delete file.txt, I type rm foob<TAB><TAB> and let the command line autocomplete the filename out to rm foobar/file.txt.

But right now, after hitting the first <TAB> my command gets autocompleted to rm foobar (with a space after foobar). Is it possible that I accidentally changed it to this behavior? How can I change it back?

share|improve this question
Is foobar a symlink or otherwise not a normal directory? – jw013 Oct 17 '12 at 19:14
@jw013 No, it is a regular directory, not a symlink – Cory Klein Oct 17 '12 at 19:17
up vote 3 down vote accepted

In my experience, this is usually caused by some misbehaving configuration in one of the files in /etc/bash_completion.d, which get installed and updated as you install various packages. My recommendation would be to move all files out of that directory, start a fresh shell, and see if the behavior returns to normal. If so, you can move files back into that directory one (or a group) at a time to see which ones cause the problem. Once you narrow it down, report a bug in whichever package installed that file!

share|improve this answer
This worked. Guess what the culprit was - Adobe Reader. facepalm Think I'll have much luck reporting that bug? I at least have to try, I guess. – Cory Klein Oct 18 '12 at 14:44

Use complete -p rm to see the current completion of rm, see if the bash function really works as you wanted.

If you don't need the completion of rm, e.g parameters like -i, just put a line like this in your bash config,

complete -r rm; complete -o default rm (Remove current completion and set the default one)

share|improve this answer

Your Answer


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.