Ubuntu – Where does “The program ‘‘ is currently not installed.” get its program list from

aptgnome-terminalpackage-management

When running the command quickly I get this output:

The program 'quickly' is currently not installed. You can install it by typing:
sudo apt-get install quickly

However when running:

apt-cache policy quickly

I just get:

N: Unable to locate package quickly

So therefore as the package quickly isn't in the repositories, where is the thing which tells me how to install a not currently installed program when I type a command that would belong to it getting its list of applications from? How does it get its list of programs and where from? Even if this is just an error, it reveals some of the workings of this program as it shows that it's not just looking at the package list which is downloaded with sudo apt-get update, otherwise it would know that the program does not exist. Also, is this just built-in functionality in gnome-terminal or is the thing responsible for the helpful message a separate application which can be uninstalled?

Best Answer

At the end of /etc/bash.bashrc you'll find some commands which ultimately define the bash function command_not_found_handle. Then man bash tells us that this command is invoked when a non-existing command is typed in. On my machine, the handle invokes /usr/lib/command-not-found as a python script. This again leads into /usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py which seems to invoke apt-get or aptitute (search for the two in the file).