When I fail to type correctly a command, for example:

luca@mostro:~$ sido
No command 'sido' found, did you mean:
 Command 'sudo' from package 'sudo' (main)
 Command 'sudo' from package 'sudo-ldap' (universe)
 Command 'sid' from package 'tendra' (universe)
sido: command not found

The command interpreter try to guess what program I wanted to run. This is very annoying to me (I associate it to google behavior).

Is it possible to remove this feature? And how?

I supposed that it were setup in my local ~/.bashrc, but the fast-check failed miserably...


3 Answers 3

sudo apt-get remove command-not-found command-not-found-data

Contrary to the other answer, you should not manually move things around under /usr unless you're trying to defenestrate your package manager.

  • There is no package 'command-not-found-data' in 22.04. Mar 21 at 10:31
  • For 22.04 sudo apt remove command-not-found does the trick. In /etc/bash.bashrc there is a check for /usr/lib/command-not-found. When removed, change is instantly effective. Mar 21 at 10:35

Both of the other answers assume root, and that you want to remove it globally for the system. If you just want to disable this for a single user (eg, your own unprivileged account), you can simply do:

unset command_not_found_handle

either on the command line for the current shell, or in their .bashrc

The feature is typically enabled globally by defining command_not_found_handle in /etc/bash.bashrc, so could also be disabled there by default, while still leaving the package available for a power user to define the function and enable the feature in their own account.

sudo apt-get remove command-not-found
sudo mv /usr/share/command-not-found /usr/share/command-not-found.bak

You need to restart your shell for the change to take affect.

  • 7
    Don't move things around under /usr that belong to packages. In the case of /usr/share/command-not-found, that directory belongs to the command-not-found-data package. Now your package manager will be confused.
    – ruief
    Aug 30, 2015 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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