command-not-found - suggest installation of missing software packages in terminal

From Kicksecure
Jump to navigation Jump to search

HowTo: install command-not-found


Quote Debian package

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.


The order in which these commands are run matter, [1] but the process is idempotent. This means it is possible to re-apply all of the following steps.

1. Delete /etc/apt/apt.conf.d/ because it contains settings that speed up but break command-not-found. [2]

sudo rm -f /etc/apt/apt.conf.d/30usability-misc

2. Install command-not-found.

Install package(s) command-not-found. Follow steps A to D.

A. Platform specific notice.

B. Update the package lists and upgrade the system The Web Archive Onion Version .

sudo apt update && sudo apt full-upgrade

C. Install the command-not-found package(s).

Using apt command line --no-install-recommends The Web Archive Onion Version is in most cases optional.

sudo apt install --no-install-recommends command-not-found

D. Platform specific notice.

E. Done.

The procedure of installing package(s) command-not-found is complete.

3. Run update-command-not-found with root rights.

sudo update-command-not-found

4. Done.

Setup of update-command-not-found has been completed.


local variable 'cnf' referenced before assignment[edit]

See Also[edit]


  1. Also apt update cannot be skipped since package contents files need to be downloaded.
  2. Acquire::IndexTargets::deb::Contents-deb::DefaultEnabled false;

    breaks command-not-found because it requires /var/lib/apt/lists/*Contents* to exist.


Unfinished: This wiki is a work in progress. Please do not report broken links until this notice is removed, use Search Engines First and contribute improving this wiki.

We believe security software like Kicksecure needs to remain Open Source and independent. Would you help sustain and grow the project? Learn more about our 12 year success story and maybe DONATE!