Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've just migrated to Zsh from Bash, but I have a bit of a problem in it. In bash on an Ubuntu system, when I type the name of a command which does not exist, Bash searches the apt database for a matching command name and prints out the package names that provide that command. It's a really useful feature, so I was wondering if something like that could be implemented in Zsh using a script or something?

Here's an example:

The program 'xmms2' is currently not installed.  You can install it by typing:
sudo apt-get install xmms2-client-cli

Or if the command is not an exact match:

No command 'xmms' found, did you mean:
Command 'lmms' from package 'lmms' (universe)
Command 'xmms2' from package 'xmms2-client-cli' (universe)
Command 'xmds' from package 'xmds' (universe)
Command 'xdms' from package 'xdms' (universe)
share|improve this question

closed as off-topic by Olli, random Feb 13 '14 at 5:05

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they become outdated quickly and attract opinion-based answers. Instead, describe your situation and the specific problem you're trying to solve. Share your research. Here are a few suggestions on how to properly ask this type of question." – random
If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 3 down vote accepted

OK, I've found the answer!
First you'll need to install a package named "command-not-found" (dunno about other distro's but in Ubuntu it's in the repositories).

sudo apt-get install command-not-found

And then you will need to edit your .zshrc and then source in the file /etc/zsh_command_not_found

source /etc/zsh_command_not_found
share|improve this answer
Just one minor detail. I get an error, say zsh: command not found: gnug, prior to the desired output. How do I get rid of that? – Nordlöw Feb 22 '12 at 21:35

Not the answer you're looking for? Browse other questions tagged .