Yum, the Fedora/RedHat/Centos package manager is a powerful tool with many hidden options and features. In this article, I'm going to show the 'provides' command which I regularly use.

I often find that I am looking for a library for some software that I have downloaded and need to know the name of the package which provides a particular file. For example, imagine that you have downloaded a nagios monitoring script and tried to run it.

./check_mysql_health.pl
Missing

The simplest way to find and install the missing package is to use yum's 'provides' command, which shows the packages which provide a particular file:

yum provides "*/Time.pm"

The double quotes are required to prevent shell expansion of the asterisk. This also allows you to search for complete file paths i.e.

yum provides "/usr/bin/bash"

Using 'provides' I can quickly find the name of the package which contains a particular file. It is particularly useful when tracking down dependencies for perl/python/php scripts.