This post will guide you how to list the files of a given package in Linux. How do I list the contents of a package using yum command in Linux.
List Contents of A package
You can use rpm -qi command to list the contents of a installed packaged in your linux system. and you can also use the repoquery command to get the contents of a package. but you can not use yum command to achieve the reuslt directly. so using one of the following command:
# rpm -qli packageName
Or
# repoquery --list packageName
For example, you need to get the information and contents of a given package called wget, you can type the following command:
# rpm -qli wget
Outputs:
[root@osetc~]# rpm -qli wget Name : wget Version : 1.19.5 Release : 6.el8 Architecture: x86_64 Install Date: Fri 28 Dec 2018 10:10:37 PM EST Group : Applications/Internet Size : 2917226 License : GPLv3+ Signature : RSA/SHA256, Tue 16 Oct 2018 10:17:04 AM EDT, Key ID 199e2f91fd431d51 Source RPM : wget-1.19.5-6.el8.src.rpm Build Date : Fri 12 Oct 2018 05:14:29 AM EDT Build Host : x86-vm-05.build.eng.bos.redhat.com Relocations : (not relocatable) Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> Vendor : Red Hat, Inc. URL : http://www.gnu.org/software/wget/ Summary : A utility for retrieving files using the HTTP or FTP protocols Description : GNU Wget is a file retrieval utility which can use either the HTTP or FTP protocols. Wget features include the ability to work in the background while you are logged out, recursive retrieval of directories, file name wildcard matching, remote file timestamp storage and comparison, use of Rest with FTP servers and Range with HTTP servers to retrieve files over slow or unstable connections, support for Proxy servers, and configurability. /etc/wgetrc /usr/bin/wget /usr/lib/.build-id /usr/lib/.build-id/ae /usr/lib/.build-id/ae/af87a0902650c25ed2555704ba3cd2ccb42b99 /usr/share/doc/wget /usr/share/doc/wget/AUTHORS /usr/share/doc/wget/COPYING ......
If you want to use repoquery command, you need to install yum-utils package firstly, type:
# yum install yum-utils
Outputs:
[root@osetc ~]# yum install yum-utils Last metadata expiration check: 0:30:46 ago on Fri 28 Dec 2018 09:43:04 PM EST. Dependencies resolved. ======================================================================================================================================== Package Arch Version Repository Size ======================================================================================================================================== Installing: dnf-utils noarch 4.0.0-1.el8 baseiso 59 k Transaction Summary ======================================================================================================================================== Install 1 Package Total download size: 59 k Installed size: 17 k Is this ok [y/N]: y Downloading Packages: dnf-utils-4.0.0-1.el8.noarch.rpm 54 kB/s | 59 kB 00:01 ---------------------------------------------------------------------------------------------------------------------------------------- Total 54 kB/s | 59 kB 00:01 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installed: dnf-utils-4.0.0-1.el8.noarch Installing : dnf-utils-4.0.0-1.el8.noarch 1/1 Installed: dnf-utils-4.0.0-1.el8.noarch Running scriptlet: dnf-utils-4.0.0-1.el8.noarch 1/1 Verifying : dnf-utils-4.0.0-1.el8.noarch 1/1 Installed: dnf-utils-4.0.0-1.el8.noarch Complete!
Then you can type the following repoquery command to list the contents of wget package:
# repoquery --list wget
outputs:
[root@osetc ~]# repoquery --list wget Last metadata expiration check: 0:31:32 ago on Fri 28 Dec 2018 09:43:04 PM EST. /etc/wgetrc /usr/bin/wget /usr/lib/.build-id /usr/lib/.build-id/ae /usr/lib/.build-id/ae/af87a0902650c25ed2555704ba3cd2ccb42b99 /usr/share/doc/wget /usr/share/doc/wget/AUTHORS /usr/share/doc/wget/COPYING /usr/share/doc/wget/MAILING-LIST /usr/share/doc/wget/NEWS /usr/share/doc/wget/README /usr/share/doc/wget/sample.wgetrc /usr/share/info/wget.info.gz /usr/share/locale/be/LC_MESSAGES/wget.mo /usr/share/locale/bg/LC_MESSAGES/wget.mo /usr/share/locale/ca/LC_MESSAGES/wget.mo /usr/share/locale/cs/LC_MESSAGES/wget.mo /usr/share/locale/da/LC_MESSAGES/wget.mo