Grimoire-
Command
.es

GNU+Linux command memo

command-not-found: which package install ?

Chercher automatiquement dans quel paquet trouver la commande manquante que l’on vient d’entrer.

# apt install command-not-found
# update-command-not-found (1)
$ echo ". /etc/zsh_command_not_fonud" >> ~/.zshrc (2)
1 command-not-found needs its own list of packages (explained in /usr/share/doc/command-not-found/README.Debian)
2 Instruct your shell about « command not found » new reaction. Exists also in bash version as explained in /usr/share/doc/command-not-found/README.

The 2ping command is missing on my system, if I try to invoke it :

$ 2ping
zsh: correct '2ping' to 'ping' [nyae]? n (1)
zsh: command not found: 2ping (2)
The program '2ping' is currently not installed.  To run '2ping' please ask your administrator to install the package '2ping' (3)
1 zsh offers a correction (as I have ENABLE_CORRECTION="true" in my ~/.zshrc)
2 But the command I really want does not exist.
3 command-not-found list the package that installs the command.

Limitation : it’s only working with packages from the main archive.