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.
- Open your Ubuntu Terminal (shortcut:
Ctrl + Alt + T). - Run the following command to remove the package:
sudo apt-get remove command-not-found command-not-found-data
- Type
Yand press Enter to confirm the removal. - 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
- 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.