Command-not-found package?

Hi, happy holidays and wish you all a great 2022!

While doing a routine maintainance on my VPS (Ubuntu Server 20.04) I saw this package was available for update.

The following packages will be upgraded:
  command-not-found libnss-systemd libpam-systemd libsystemd0 libudev1
  openssh-client openssh-server openssh-sftp-server python3-commandnotfound
  systemd systemd-sysv systemd-timesyncd udev

However I could not found any information online about any package called “command-not-found” nor it seemed to be installed in my machine. Although to be fair I only checked if it existed as a command by running which and the man pages for it.

Do you guys have any idea what it is and what it does, and also what python3-commandnotfound which I assume is somehow related? And how could I upgrade some packages of my choice rather than upgrade all of them listed here? Thanks!

It’s for when you either type a command that isn’t installed, or mis-type a command. It tries to figure out, using the package catalog, what command you might have been trying to type and/or what package(s) would provide it.

$ apt show command-not-found
Package: command-not-found
Version: 20.04.5
Priority: standard
Section: admin
Origin: Ubuntu
Maintainer: Michael Vogt <michael.vogt@ubuntu.com>
Original-Maintainer: Zygmunt Krynicki <zkrynicki@gmail.com>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 36.9 kB
Depends: python3-commandnotfound (= 20.04.5)
Suggests: snapd
Task: standard
Phased-Update-Percentage: 70
Download-Size: 5,244 B
APT-Manual-Installed: yes
APT-Sources: http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
Description: 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.

You don’t have to accept the list; you can copy-paste or just type the ones you want in your apt get command.

3 Likes

Thank you it’s good to know how to check for packages in the future using apt show! I’ve only ever used it a few times to check versions not descriptions

1 Like