Find which package provides a file - Yum and Apt
Last updated 2019-06-26
Yum-based distros
On Fedora-like systems, the default package manager is yum (or dnf for Fedora 22+). The main way you use it is to install packages and auto-resolve the dependencies.
yum install irfan
Similarly, apt-get on the Debian family of GNU/Linux installs packages with this command.
apt-get install irfan
Now, let's say you are looking for which package installs a particular file. The command for yum is:
yum provides */filename
If you want to use rpm, that is available too.
rpm -qf /etc/sudoers
Apt-based distros
On apt-based distros (Debian, Devuan, Ubuntu, etc.), you need to install the package apt-file before you can do similar lookup commands.
apt-get install apt-file
Now you can search with:
apt-file search */filename
You can use the lower-level package manager:
dpkg-query -S /usr/share/filename
Comments