How To Install command-not-found on Ubuntu 20.04

In this tutorial we learn how to install command-not-found on Ubuntu 20.04. command-not-found is Suggest installation of packages in interactive bash sessions Suggest installation of packages in interactive bash sessions

Introduction

In this tutorial we learn how to install command-not-found on Ubuntu 20.04.

What is command-not-found

command-not-found is:

This package will install a handler for command_not_found that looks up programs not currently installed but available from the repositories. Task: standard

Package: command-not-found Architecture: all Version: 20.04.2 Priority: standard Section: admin Origin: Ubuntu Maintainer: Michael Vogt [email protected] Original-Maintainer: Zygmunt Krynicki [email protected] Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 35 Depends: python3-commandnotfound (= 20.04.2) Suggests: snapd Filename: pool/main/c/command-not-found/command-not-found_20.04.2_all.deb Size: 5240 MD5sum: e0a92a618c94f359e6ed4f178ef5e798 SHA1: addf392df5022cadb18ed43a532d761adcf7cb65 SHA256: a16aeab1e7c7d74d91509bd1722715f11b41572ff21de2ec9dfb8739f71452a2 Description-en: Suggest installation of packages in interactive bash sessions This package will install a handler for command_not_found that looks up programs not currently installed but available from the repositories. Task: standard

There are three methods to install command-not-found on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install command-not-found Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install command-not-found using apt-get by running the following command:

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

Install command-not-found Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install command-not-found using apt by running the following command:

sudo apt -y install command-not-found

Install command-not-found Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install command-not-found using aptitude by running the following command:

sudo aptitude -y install command-not-found

How To Uninstall command-not-found on Ubuntu 20.04

To uninstall only the command-not-found package we can use the following command:

sudo apt-get remove command-not-found

Uninstall command-not-found And Its Dependencies

To uninstall command-not-found and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

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

Remove command-not-found Configurations and Data

To remove command-not-found configuration and data from Ubuntu 20.04 we can use the following command:

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

Remove command-not-found configuration, data, and all of its dependencies

We can use the following command to remove command-not-found configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge command-not-found

References

Summary

In this tutorial we learn how to install command-not-found package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.