Search yum for the content of a package

Yum can do more things than just a yum search $package. It also allows you to search for a package that contains a certain file. For that, you can use the yum whatprovides command.

For instance, if you want to search for what package contains the /usr/bin/node binary (for NodeJS), you can search like this.

$ yum whatprovides */usr/bin/node
...
nodejs-0.10.32-1.el6.i686 : JavaScript runtime
Repo        : epel
Matched from:
Filename    : /usr/bin/node


nodejs-0.10.32-1.el6.x86_64 : JavaScript runtime
Repo        : epel
Matched from:
Filename    : /usr/bin/node

The syntax is yum whatprovides */path/to/your/file or a wildcard, like yum whatprovides */file. To search the node binary, you can also make it shorter:

$ yum whatprovides */node
...

And there’s a few more little tricks that yum provides as well.