Ubuntu – Getting command-not-found working under zsh

command linezsh

I'm trying to get the command-not-found feature under Ubuntu to work under zsh, without luck:

➜  ~  pdfunite
zsh: command not found: pdfunite
➜  ~  bash
u@ub:~$ pdfunite
The program 'pdfunite' is currently not installed.  You can install it by typing:
sudo apt-get install poppler-utils

Does anyone know if there is a package available that also supports zsh?

Thank you.

Best Answer

  • You have to source it in your .zshrc:

    if [[ -s '/etc/zsh_command_not_found' ]]; then
      source '/etc/zsh_command_not_found'
    fi
    

    The script is part of the package command-not-found:

    $ apt-cache search zsh_command_not_found
    > command-not-found: /etc/zsh_command_not_found
    
  • Related Question