Debian Package Install Suggestion – How to Implement on Debian

autocompletebashcommand-not-founddebianUbuntu

I have noticed that while on Ubuntu, if I type the following:

mc

and it isn't installed, I get the message below:

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

However in Debian, that is not available. It just gives a "-bash: /usr/bin/mc: No such file or directory" message. How can I implement the same functionality in bash command line on Debian? Yes, I know that if it is package suggestion that I want, I can simply do a regex search using apt-cache search. However I was hoping for the simpler suggestion immediately on typing the name of the program.

As per discussions, the functionality is provided by the package command-not-found. However even after installing it, and also installing bash-completion package, this isn't available on the Debian bash shell.

Best Answer

The reason that installing command-not-found did not start providing suggestions for non-installed packages was that I had missed a small notification from dpkg as part of the install.

One is supposed to run the command update-command-not-found immediately after running apt-get install command-not-found. In fact dpkg prompts for running this command.

Related Question