How To Install command-not-found on Kali Linux

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

Introduction

In this tutorial we learn how to install command-not-found on Kali Linux.

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.

There are three methods to install command-not-found on Kali Linux. 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 on Kali Linux first since aptitude is usually not installed by default on Kali Linux. 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 Kali Linux

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 Kali Linux, 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 Kali Linux 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

Dependencies

command-not-found have the following dependencies:

References

Summary

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