How to Disable the ‘Command Not Found’ Package Suggestion Tool in Ubuntu Terminal

What is the “Command Not Found” Tool?

When you type a command into the Ubuntu Linux terminal that does not exist or is not installed, Ubuntu intercepts the standard “command not found” error and instead runs a background script. This script searches the Ubuntu software repositories and suggests the apt packages you need to install to get the command working.

While helpful for beginners, this script significantly slows down the terminal. Every time you make a minor typo, your terminal freezes for a second or two while it searches the database. If you know what you are doing and prefer the terminal to fail instantly upon a typo, you can disable this feature.

How to Remove the Package Suggestion Tool in Ubuntu

The feature is controlled by a specific package called command-not-found. The cleanest way to disable the suggestions and restore the default, fast bash error behavior is to uninstall this package entirely.

  1. Open your Ubuntu Terminal (shortcut: Ctrl + Alt + T).
  2. Run the following command to remove the package:
sudo apt-get remove command-not-found command-not-found-data
  1. Type Y and press Enter to confirm the removal.
  2. After the package is removed, you need to update your system’s bash configuration so it stops trying to call the script. Run the following command to update your bashrc file:
sudo apt-get autoremove
  1. Finally, for the changes to take effect immediately, reload your terminal session by either closing and reopening the terminal, or running:
source ~/.bashrc

Now, if you type a non-existent command like sl instead of ls, the terminal will instantly return a clean bash: sl: command not found error without hanging or suggesting packages to install, saving you valuable time.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.