8

I use Fedora 23. In an older version of Fedora (or maybe it was Ubuntu), I used to get package suggestions at the command line (Bash) when a command wasn't found. I liked this.

$ glmark2
Command not found
Command glmark2 is provided by package glmark2. 
Would you like to install it? (y/n)
Installed package glmark2.

How can I get this feature in Fedora 23?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Colonel Panic
  • 453
  • 2
  • 8
  • 19

1 Answers1

10

The package on Fedora is called PackageKit-command-not-found.

The Fedora package installs a hook in /etc/profile, so it's only available in login shells. To make it available in all interactive instanced of bash, add the following lines to your ~/.bashrc:

if [ -e /etc/profile.d/PackageKit.sh ]; then
  . /etc/profile.d/PackageKit.sh
fi
Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
  • It isn't in pkgdb because pkgdb is indexed by source RPMs, and this one is built as a subpackage of the main PackageKit source RPM. – mattdm Dec 14 '15 at 13:27
  • @mattdm Ah, thanks. Is there a way to look up binary packages on pkgdb or a similar site? I guess there's always rpmfind, but that requires pinpointing a version and architecture. – Gilles 'SO- stop being evil' Dec 14 '15 at 14:56
  • Yeah — you can search for it in [Fedora Packages Search](https://apps.fedoraproject.org/packages/), which is a _different_ application meant to be more end-user-useful. (pkgdb is really a packager-centric view.) – mattdm Dec 14 '15 at 14:59
  • So, https://apps.fedoraproject.org/packages/PackageKit-command-not-found – mattdm Dec 14 '15 at 15:00
  • @mattdm Thanks. I wonder how search operates: [searching for `command-not-found`](https://apps.fedoraproject.org/packages/s/command-not-found) turns up 0 results. Is it searching descriptions only and not package names? – Gilles 'SO- stop being evil' Dec 14 '15 at 15:09
  • 1
    I'll have to check. I found it by searching for the full string `PackageKit-command-not-found` – mattdm Dec 14 '15 at 15:57
  • Thanks, I actually wanted to get rid of it. – akostadinov Apr 29 '21 at 09:34