{{Header}}
{{Title|
title=command-not-found - suggest installation of missing software packages in terminal
}}
{{#seo:
|description=HowTo: install command-not-found
|image=Notfound14123523.png
}}
[[File:Notfound14123523.png|thumb|250px]]
{{intro|
HowTo: install command-not-found
}}
= Introduction =
Quote Debian package [https://packages.debian.org/{{Stable project version based on Debian codename}}/command-not-found <code>command-not-found</code>]:

<blockquote>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.</blockquote>

= Installation =

The order in which these commands are run matter, <ref>
Also <code>apt update</code> cannot be skipped since package contents files need to be downloaded.
</ref> but the process is idempotent. This means it is possible to re-apply all of the following steps.

{{Box|text=
'''1.''' Delete [https://github.com/{{project_name_short}}/usability-misc/blob/master/etc/apt/apt.conf.d/30usability-misc <code>/etc/apt/apt.conf.d/30usability-misc</code>] because it contains settings that [https://forums.whonix.org/t/speeding-up-apt-update-with-acquire-languages-none-and-contents-deb-defaultenabled-false-its-so-much-faster/8894 speed up APT] but break <code>command-not-found</code>. <ref>
<pre>
Acquire::IndexTargets::deb::Contents-deb::DefaultEnabled false;
</pre>

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

See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=857090
</ref>

{{CodeSelect|code=
sudo rm -f /etc/apt/apt.conf.d/30usability-misc
}}

'''2.''' Install <code>command-not-found</code>.

{{Install Package|
package=command-not-found
}}

'''3.''' Run <code>update-command-not-found</code> with root rights.

{{CodeSelect|code=
sudo update-command-not-found
}}

'''4.''' Done.

Setup of <code>update-command-not-found</code> has been completed.
}}

= Issues =
== local variable 'cnf' referenced before assignment ==
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=917455
* https://salsa.debian.org/jak/command-not-found/-/merge_requests/1

= See Also =

* [[apt-file|<code>apt-file</code>]]
* [https://forums.whonix.org/t/command-not-found-warningcould-not-open-file-etc-apt-sources-list/7903 command-not-found - WARNING:root:could not open file '/etc/apt/sources.list']
* [https://forums.whonix.org/t/speeding-up-apt-update-with-acquire-languages-none-and-contents-deb-defaultenabled-false-its-so-much-faster/8894 Speeding up "apt update" with Acquire::Languages=none and Contents-deb::DefaultEnabled=false - It's so much faster!]

= Footnotes =
{{reflist|close=1}}
[[Category:Documentation]]
{{Footer}}