zsh suggesting what packages to install [duplicate]

I love using zsh but there is one feature that bash has that I miss. It is this one:

➜  ~  bash

dbugger@mercury:~$ man2html
The program 'man2html' is currently not installed. You can install it by typing:
sudo apt-get install man2html-base

dbugger@mercury:~$ exit
exit

➜  ~  man2html
zsh: command not found: man2html

When I type a command that is not install, but it can be easily installed, bashtells you so, but zshno.

Is there any way to fix this?


Solution 1:

Make sure the command-not-found package is installed (it should be by default). Then open up your .zshrc file in your favourite text editor and append this line at the bottom:

source /etc/zsh_command_not_found  

Then run

source .zshrc  

in your terminal. Now when you try to run a program that isn't installed:

➜  ~  man2html
The program 'man2html' is currently not installed. You can install it by typing:
sudo apt-get install man2html-base
zsh: command not found: man2html
➜  ~