People have already responded with:
rpm -q --requires PKG
yum -q deplist PKG
Yes, either rpm
or yum
works and correctly answers the question. The main difference between rpm
and yum
is that yum also shows what packages you can install to meet the library and/or file requirements. Unfortunately, if the package isn't installed, neither one of these methods are useful. Since the original poster already specified that the package you are checking is installed, this is a mute point.
What if you didn't have the package installed? yum
can still be used, but indirectly. You can do a mock install by canceling the install operation.
printf n | yum install PKG | grep -- "---> Package"
Here is an example:
printf n | yum install php | grep -- "---> Package"
---> Package php.x86_64 0:5.4.16-45.el7 will be installed
---> Package php-cli.x86_64 0:5.4.16-45.el7 will be installed
---> Package php-common.x86_64 0:5.4.16-45.el7 will be installed
---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed