Where is /etc/PackageKit/CommandNotFound.conf?

The Linux distro I’m used to has this wonderful feature enabled where if you type a command into the terminal and you happen to have it not installed, it just prompts you if you wish to install it and then it does it and runs the command. Fantastic for a beginner reading various Linux tips online!

But I can’t find the file in which I enable this setting in EndeavourOS.

Anyone know where it’s located and how to enable it here?

Install the package pkgfile unless you already have it. Then run sudo pkgfile -u. Then add the following to your ~/.bashrc

source /usr/share/doc/pkgfile/command-not-found.bash
3 Likes

Thank you for the instructions!

After following them, I got as far as instead of getting an error, I get a text looking like this:

[eobet@leplup ~]$ fastfetch
fastfetch may be found in the following packages:
  extra/fastfetch 2.15.0-1	/usr/bin/fastfetch

Do you know what additional things I must do to get the Y/n auto install prompt?

If that isn’t enough for you could install find-the-command from AUR.

The bottom of this page has a demonstration of how it works.

1 Like

Thank you again, and just to clarify, is find-the-command is an alternative (a replacement) to command-not-found or a complement to it?

I ask, because in the other distro I use, pkgfile is preinstalled with the auto installation question, and it’s enabled by this file (the one mentioned in the title of this topic):

However, after installing pkgfile in EndeavourOS and even now attempting to add this file manually, it doesn’t work. So is this because Arch behaves differently to something that’s Fedora based when it comes to this particular utility?

It is an alternative

They are different utilities and completely different package management systems. This is one area where different distros have completely different features.

1 Like