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

HowTo: install command-not-found
Introduction
[edit]From the Debian package description command-not-found![]()
:
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.
Installation
[edit]The order in which these commands are run matters [1] but the process is idempotent. This means it is possible to re-apply all of the following steps.
1 Sysmaint Notice
2 Delete file /etc/apt/apt.conf.d/30usability-misc. [2]
sudo safe-rm -f -- /etc/apt/apt.conf.d/30usability-misc
3 Install command-not-found.
Install package(s) command-not-found following these instructions:
1 Platform specific notice.
- Kicksecure: No special notice.
- Kicksecure-Qubes: In Template.
2 Update the package lists and upgrade the system.
sudo apt update && sudo apt full-upgrade
3 Install the command-not-found package(s).
Using apt command line --no-install-recommends option is in most cases optional.
sudo apt install --no-install-recommends command-not-found
4 Platform specific notice.
- Kicksecure: No special notice.
- Kicksecure-Qubes: Shut down Template and restart App Qubes based on it as per Qubes Template Modification.
5 Done.
The procedure of installing package(s) command-not-found is complete.
4 Update the command-not-found database.
sudo update-command-not-found
5 Done.
The setup of command-not-found has been completed.
Issues
[edit]Local variable 'cnf' referenced before assignment
[edit]- Debian bug report: Debian bug #917455

- Debian merge request: Debian Salsa merge request !1

See Also
[edit]- Related tool:
apt-file - Forum discussion: command-not-found - WARNING:root:could not open file '/etc/apt/sources.list'

- Forum discussion: Speeding up "apt update" with Acquire::Languages=none and Contents-deb::DefaultEnabled=false - It's so much faster!

Footnotes
[edit]- ↑
Also
apt updatecannot be skipped since package contents files need to be downloaded. - ↑
Delete
/etc/apt/apt.conf.d/30usability-miscbecause it contains settings that speed up APT

but break
command-not-found.Acquire::IndexTargets::deb::Contents-deb::DefaultEnabled false;
This breaks
command-not-foundbecause it requires/var/lib/apt/lists/*Contents*to exist.See: Debian bug #857090

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 13 year success story and maybe DONATE!