How to find which package provides a command in yum

CentOS-LogoSometimes you know you need a package, but when you try to install it with yum you’ll get a message like “No matches found”. Yet you’re sure the package exists because you’ve used it before.

This can happen if the package in question is part of a set which installs multiple packages. The net-tools package springs to mind.

yum has a great option called whatprovides with which you can query what package you need to install to use a command. Let’s try it out!

Say I wanted to install mkfs.vfat which is not installed by default in CentOS. Simply trying to install it won’t work:

Of course it won’t. But I can ask yum what provides this package:

Well fantastic! The package I’m looking for is called dosfstools. Knowing that, I can simply use yum install dosfstools, and a few moments later mkfs.vfat will work as expected.

Thanks, yum!

About Jay Versluis

Jay is a medical miracle known as a Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

Add your voice!