Linux what package provides a file

Using rpm

We can use rpm on Centos/RHEL/Amazon Linux based system to file which package provides a specific file. e.g.

rpm -q -f /usr/bin/watch
procps-3.2.8-45.16.amzn1.x86_64

Alternatively we can use

rpm -q --whatprovides /usr/bin/watch

Using yum

It is used to find packages on repository. I also supports pattern match in name. e.g.

yum whatprovides /usr/bin/watch

Share this article: share on facebook share on linkedin tweet this submit to reddit