11

When I mis-type a command, the shell tries to find a package that provides it. How do I disable this feature?

Example:

[dave@dave cpp]$ sl
bash: sl: command not found...
Install package 'sl' to provide command 'sl'? [N/y] 

I'd like if if I weren't prompted to install the command.

2
  • Wow, that seems annoying beyond reason! I know Ubuntu uses similar package suggestion, but at least it doesn't end in a prompt. Is this standard in Fedora Desktop? I run Fedora on a server and do not recognize it. Sep 5, 2013 at 15:04
  • @DanielAndersson Fedora is the same, package PackageKit-command-not-found Mar 15 at 10:06

2 Answers 2

16

The problem is PackageKitCommandNotFound. Removing it

yum remove PackageKit-command-not-found

should do the trick, according to the mailing list.

5

After doing a

yum remove PackageKit-command-not-found

if you get the error,

bash: /usr/libexec/pk-command-not-found: No such file or directory

you will need to add the follow line to ~/.bashrc

unset command_not_found_handle
3
  • Or log out and back in again. It's worth noting that unsetting command_not_found_handle is sufficient even without removing the package.
    – mattdm
    Apr 19, 2016 at 21:31
  • @mattdm it's not sufficient, still need to remove that package.
    – DominiCane
    Jul 25, 2019 at 10:58
  • @DominiCane It is. The bash procedure command_not_found_handle is defined in /etc/profile.d/PackageKit.sh (which belongs to package PackageKit-command-not-found). As long as you unset the variable for that procedure after /etc/profile.d/PackageKit.sh, it's fine. And that is done by adding a file that is run later than PackageKit.sh. As sorting is done by name, xx_undoPackageKit.sh in /etc/profile.d sounds good. Mar 15 at 10:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .