Adding “command not found” apt package suggestions to zsh
Under the GNU Bash shell on a Debian-based system, if you type a command that is unrecognised, in addition to an error message telling you that the command is not found, you also get package suggestions for the apt package manager.
This is a wonderful pattern in interface design: instead of just telling you that something went wrong and leaving you to figure out what it was, we give you helpful suggestions to try and lead you in the right direction. In this specific use case, it also means that you get to discover new app packages that you might otherwise not have.
My shell of choice, zsh1, doesn’t have this feature built-in but, thankfully, someone created a package called command-not-found that you can easily install to enable it:
sudo apt update sudo apt install command-not-found echo 'source /etc/zsh_command_not_found' >> ~/.zshrc source ~/.zshrc
Now, when you try to execute a command that doesn’t exist, zsh will helpfully suggest a package or two that you might want to install that might have the command you were thinking of.
I use zsh with the excellent Oh My ZSH! configuration with the agnoster theme with powerline fonts. ↩︎