Possible Duplicate:
rebuild auto-complete index (or whatever it's called)

After I install something via aptitude, zsh won't be able to find it until I search for it with which. For example

~ sudo apt-get install xsane
~ xsa<Tab>
~ saned
~ which xsane

This naturally is pretty annoying. Is there a zsh setting for this? Or is it a bug? Or what?

marked as duplicate by phunehehe, echox, Gilles, Michael Mrozek Nov 10 '10 at 6:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    @Maciej: This isn't quite the same question: the other question is about rebuilding the cache manually, this one is about doing it automatically. – Gilles Nov 8 '10 at 1:54
  • @Gilles I think the answers are probably the same though (and your accepted answer on the other question covers this already) – Michael Mrozek Nov 8 '10 at 1:55
  • 1
    You can tell zsh not to trust its cache when completing with zstyle ":completion:*:commands" rehash 1. There is a performance cost, but it is negligible on a typical desktop setting today. (It isn't if you have $PATH on NFS, or a RAM-starved system.) For a one-time need, run rehash to rebuild the command cache. – Gilles Nov 8 '10 at 1:55
  • @Michael: I don't think my answer on the other command covers Falmarri's question. I was in the process of writing one (see previous comment) when the closed question notice came. – Gilles Nov 8 '10 at 1:58
  • @Gilles Oh, hash_list_all isn't it? Well, I'll reopen this; if it is a dupe it can always be closed again and merged – Michael Mrozek Nov 8 '10 at 1:59

Browse other questions tagged or ask your own question.