How to Install and Uninstall command-not-found on Ubuntu 22.04

Updated: September 5, 2022

This package will install a handler for command_not_found that looks up programs not currently installed but available from the repositories. In this guide, I will show you how to install command-not-found on Ubuntu 22.04.

Prerequisites to install

  • OS: Ubuntu 22.04 is needed for command-not-found to work
  • Privileges: Verify that you can execute the sudo commands line.

Prerequisites to install command-not-found on Ubuntu 22.04

Install command-not-found Ubuntu 22.04

command-not-found is one of the popular ways on Ubuntu now so that this tutorial will show you some ways to install it. Choose the one you believe is simple and easy to follow.

Install command-not-found using APT

This is one of the most popular methods for installing Ubuntu packages since it is simple to understand, even if you are a Linux novice. Following these steps to get command-not-found on your Ubuntu.

Step 1: You must update the APT package repository cache before attempting to install, update, or remove any packages. Obtain new packages from Ubuntu by updating the APT database. Launching the terminal and entering the following Linux command:

sudo apt-get update

Step 2: Install the package on Ubuntu 22.04. You can now install command-not-found Ubuntu by executing this command in the terminal.

sudo apt-get -y install command-not-found

Install command-not-found using Aptitude

Users can manage their installation, upgrade, and removal of packages with Aptitude and view a list of the packages that are currently available. If you haven’t already installed it on Ubuntu, run this command to do so.

sudo apt install aptitude

After that, you can now install command-not-found by following these steps:

Step 1: The APT package repository cache needs to be updated before you try to install, update, or remove any packages. Update the APT database to download new packages from Ubuntu. Opening the terminal and executing the following Linux command:

sudo apt-get -y update

Step 2: Start the package installation on Ubuntu 22.04. After updating, you can install command-not-found Ubuntu by executing this command in the terminal.

sudo aptitude -y install command-not-found

Uninstall command-not-found on Ubuntu 22.04

Have you ever thought that uninstalling an application from Ubuntu is difficult? You are mistaken; Anyone can easily uninstall any program, not just command-not-found.

You can uninstall command-not-found Ubuntu by running this command if you installed it using APT or Aptitude.

sudo apt remove --auto-remove command-not-found

You can also execute this command if you want to uninstall command-not-found and remove its data and dependencies:

sudo apt autoremove --purge command-not-found

Ending

In this guide, I showed you ways to install command-not-found on Ubuntu 22.04 and ways to uninstall command-not-found too. Please do not hesitate to contact me if you require assistance. I’m delighted to respond.