After renaming a file to a similar name, I noticed TAB was still completing the old filename (if it matched the letters so far) and not showing the new one. No matter how many letters I typed, it refused to complete the new name.

I fixed it simply by starting a new shell. All good, but I'm still curious about what happened.

I assume Bash is caching the file strings somewhere and the cache had failed to refresh/clear itself when the file had been renamed. Is my assumption correct, and if so, how could the cache be auto-refreshed?

  • Bash doesn't cache filenames internally, unless you have some funky bash completion from somewhere else that's doing it. Were you just doing x/y/z, or some_command x/y/z? I think it's much more likely that it could be a third party bash completion doing it judging by the description. – Chris Down Oct 15 '15 at 14:57
  • Ah yes, I had recently installed github.com/git/git/blob/master/contrib/completion/…. Must be it. – mahemoff Oct 15 '15 at 23:43

I had recently installed git completion which does some caching. I'll need to look in more detail but anyway, it does cache, so that's the cause here.

  • Did you ever resolve how to clear the cache? – Novice C Sep 15 '17 at 21:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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