Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

One of the features of Ubuntu that I really like is the one that suggests packages to install if you try to run a program that isn't installed, like this:

$ nmap
The program 'nmap' is currently not installed. You can install it by typing:
sudo apt-get install nmap

Is that a fancy feature of Bash? An extra daemon that hides in the background? How does it do that?

share|improve this question
add comment

2 Answers

up vote 8 down vote accepted

command-not-found Install command-not-found is the package you are looking for.

share|improve this answer
add comment

Just as an addition to the previous answer:

To switch this off for your own account (without deinstalling the whole package and so disabling this for ALL users), you may just add the following line to your own ~/.bashrc:

unset command_not_found_handle

This reverts to the default bevaviour of bash (see /etc/bash.bashrc for the definition of the function command_not_found_handle: it calls command-not-found if it is installed, otherwise it prints the default "command not found" error message).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.