Is it possible to tell zsh to not autocomplete certain commands when using TAB completion ?


I type chm <tab> and zsh completion offers me two options:

chmem  chmod

I never use chmem. Instead of having two options, I would prefer to have chm automatically completed to chmod.

1 Answer 1


You can do:

zstyle ':completion:*:*:-command-:*:*' ignored-patterns 'chmem'

If you needed to do more than one ignored pattern, you would do it like this:

zstyle ':completion:*:*:-command-:*:*' ignored-patterns 'chmem|chcpu|chcon'
  • perfect. that works. thanks a lot Jul 31, 2019 at 7:47
  • @Gilles - my list of ignored-patterns has gotten quite large. Is it possible to save the list in a file, and specify `zstyle ':completion:*:*:-command-:*:*' ignored-patterns /PATH/TO/FILE' ? Sep 3, 2022 at 4:17
  • 1
    @MartinVegter Assuming the file contains one element per line: … "${(@f)$(</PATH/TO/FILE)}" Sep 3, 2022 at 12:14

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.