Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 have noticed that while on Ubuntu, if I type the following:


and it isnt 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 isnt available on the Debian bash shell.

share|improve this question
up vote 11 down vote accepted

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.

share|improve this answer

The debian package seems to be incomplete. The README says that you should source /etc/bash_command_not_found in your .bashrc. Strangely that file is not included in the package.

The debian command-not-found package is based on the ubuntu package. The ubuntu package seems to be more complete in that regard.

Content of the ubuntu version of bash_command_not_found:

command_not_found_handle() {
  if  [ -x /usr/lib/command-not-found ]; then
     /usr/lib/command-not-found -- "$1" 
     return $?
     return 127

Add those lines to your ~/.bashrc (or /etc/bash.bashrc) and the command-not-found feature should work.

share|improve this answer

Your Answer


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.