如何在命令行获取自动包建议?

Col*_*nic 7 bash fedora command-not-found

我使用 Fedora 23。在较旧版本的 Fedora(或者可能是 Ubuntu)中,当找不到命令时,我曾经在命令行 (Bash) 中获取软件包建议。我喜欢这个。

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

如何在 Fedora 23 中获得此功能?

Gil*_*il' 9

Fedora 上的软件包称为PackageKit-command-not-found.

Fedora 软件包在 中安装了一个钩子/etc/profile,因此它只能在登录 shell 中使用。要使其在 bash 的所有交互式实例中可用,请将以下几行添加到您的~/.bashrc

if [ -e /etc/profile.d/PackageKit.sh ]; then
  . /etc/profile.d/PackageKit.sh
fi
Run Code Online (Sandbox Code Playgroud)