CentOS:什么软件包包含X文件

在CentOS上,使用yum或其他软件(文本模式)。 我如何search一个包,例如search包含smbclient的包?

 sudo yum whatprovides *bin/smbclient 

你可以用yum search TEXT

您可以查看rpm -qf /path/to/file来确定哪个已经安装的软件包包含特定的文件。 (或者说该文件属于哪个包)

正如已经提到的,你可以使用yum whatprovides /path/to/file 。 这将列出所有可能提供给你的文件(安装,更新,基地等)的软件包。

但是,如果你只想find当前在你的系统上提供文件的包,我宁愿使用rpm -qf path/to/file ,因为结果很干净:)

例如,如果你使用yum作为/bin/cp

 # yum whatprovides /bin/cp Loaded plugins: fastestmirror, refresh-packagekit, security ... coreutils-8.4-19.el6.i686 : A set of basic GNU tools commonly used in shell scripts Repo : base Matched from: Filename : /bin/cp coreutils-8.4-16.el6.i686 : A set of basic GNU tools commonly used in shell scripts Repo : installed Matched from: Other : Provides-match: /bin/cp 

如果你使用rpm作为/bin/cp

 # rpm -qf /bin/cp coreutils-8.4-16.el6.i686