System

Find Out Which RPM Installed a Specific File by rpm or yum Command

Finding which package installed a file or command is straightforward with rpm or yum. However, yum needs access to the repository data service. If it cannot connect and has no cached data, it cannot perform the lookup; if cached data is available, it can. For convenience, I recommend remembering the rpm command. On Red Hat, CentOS, or other Linux distributions using rpm or yum, run the following commands.


[root@ezylinux ~]# rpm -qf /path/to/file 
[root@ezylinux ~]# yum provides /path/to/file

For example, to find which RPM package contains kde-config, first use which to find its path, then use that path with rpm or yum.


[root@ezylinux ~]#which kde-config
/usr/bin/kde-config

Use rpm to find the package containing the file.


[root@ezylinux ~]# rpm -qf /usr/bin/kde-config 
kdelibs-3.5.4-22.el5_3

Use yum to find the package containing the file.


[root@ezylinux ~]# yum provides /usr/bin/kde-config
Loading "dellsysidplugin2" plugin
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
 * atrpms: dl.atrpms.net
 * extras: mirror.yourconnect.com
 * rpmforge: fr2.rpmfind.net
 * base: mirror.oscc.org.my
 * addons: mirror.oscc.org.my
 * updates: mirror.yourconnect.com
kdelibs.i386 : K Desktop Environment - Libraries
kdelibs.x86_64 : K Desktop Environment - Libraries
EOF.← Back to articles