Finding which package provided a file on a CentOS Linux system

Have a dream? Start learning your way toward it with courses from $12.99. Shop now for extra savings1px

If you wish to know which package provided a file on a CentOS Linux system, you can use the RPM command rpm -qf followed by the location and name of the file. E.g., to find which package provided the geopiplookup utility, which allows one to determine which country a particular IP address is associated with, I could determine the file's location and then use the RPM query.

[root@localhost ~]# which /usr/bin/geoiplookup
/usr/bin/geoiplookup
[root@localhost ~]# rpm -qf /usr/bin/geoiplookup
GeoIP-1.5.0-13.el7.x86_64
[root@localhost ~]#

If you want information on the package, you can use the rpm -qi packagename command. E.g.:

[root@localhost ~]# rpm -qi GeoIP
Name        : GeoIP
Version     : 1.5.0
Release     : 13.el7
Architecture: x86_64
Install Date: Sat 09 Feb 2019 10:28:14 PM UTC
Group       : Development/Libraries
Size        : 3912607
License     : LGPLv2+ and GPLv2+ and CC-BY-SA
Signature   : RSA/SHA256, Mon 12 Nov 2018 02:26:31 PM UTC, Key ID 24c6a8a7f4a80eb5
Source RPM  : GeoIP-1.5.0-13.el7.src.rpm
Build Date  : Tue 30 Oct 2018 10:02:28 PM UTC
Build Host  : x86-01.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://www.maxmind.com/app/c
Summary     : Library for country/city/organization to IP address or hostname mapping
Description :
GeoIP is a C library that enables the user to find the country that any IP
address or hostname originates from. It uses a file based database that is
accurate as of June 2007 and can optionally be updated on a weekly
basis by installing the GeoIP-update package. This database simply contains IP
blocks as keys, and countries as values. This database should be more complete
and accurate than using reverse DNS lookups.

This package includes GeoLite data created by MaxMind, available from
http://www.maxmind.com/
[root@localhost ~]#

Alternatively, you can use yum to determine which package contains a file and which repository provides the package. E.g.:

[root@localhost ~]# yum whatprovides /usr/bin/geoiplookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * epel: mirror.dal.nexril.net
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
GeoIP-1.5.0-14.el7.i686 : Library for country/city/organization to IP address or
                        : hostname mapping
Repo        : base
Matched from:
Filename    : /usr/bin/geoiplookup



GeoIP-1.5.0-14.el7.x86_64 : Library for country/city/organization to IP address
                          : or hostname mapping
Repo        : base
Matched from:
Filename    : /usr/bin/geoiplookup



GeoIP-1.5.0-13.el7.x86_64 : Library for country/city/organization to IP address
                          : or hostname mapping
Repo        : @base
Matched from:
Filename    : /usr/bin/geoiplookup



[root@localhost ~]#

Related

  1. Determining the Country Associated with an IP Address
    Date: August 28, 2004
  2. Determining what package provides a file on a CentOS system
    Date: June 13, 2015
  3. Failed POP3 login attempts from 94.136.51.56
    Date: September 22, 2017