Tutorial details Difficulty Easy (rss) Root privileges Yes Requirements yum command

RHEL/SL/CentOS Time N/A

ADVERTISEMENTS



How to list the contents of a package using yum command

The procedure to list the files installed by a yum package:

Open the terminal bash shell and type:

sudo yum install yum-utils See the files installed by a yum package named bash:

repoquery --list bash

repoquery -l '*bash*'

Let us see installation and usage in details.

Installation

First you need to install yum-utils package. It is a collection of utilities and examples for the yum package manager. It includes utilities by different authors that make yum easier and more powerful to use. Type the following yum command to install yum-utils package:

# yum -y install yum-utils

Sample outputs:

Loaded plugins: product-id, protectbase, rhnplugin, security, subscription- : manager Updating certificate-based repositories. Unable to read consumer identity 0 packages excluded due to repository protections Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package yum-utils.noarch 0 :1.1.30- 14 .el6 will be installed --> Finished Dependency Resolution Dependencies Resolved = =============================================================================== Package Arch Version Repository Size = =============================================================================== Installing: yum-utils noarch 1.1.30- 14 .el6 rhel-x86_64-server- 6 101 k Transaction Summary = =============================================================================== Install 1 Package ( s ) Total download size: 101 k Installed size: 0 Downloading Packages: yum-utils-1.1.30- 14 .el6.noarch.rpm | 101 kB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : yum-utils-1.1.30- 14 .el6.noarch 1 / 1 Installed products updated. Verifying : yum-utils-1.1.30- 14 .el6.noarch 1 / 1 Installed: yum-utils.noarch 0 :1.1.30- 14 .el6 Complete! Loaded plugins: product-id, protectbase, rhnplugin, security, subscription- : manager Updating certificate-based repositories. Unable to read consumer identity 0 packages excluded due to repository protections Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package yum-utils.noarch 0:1.1.30-14.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: yum-utils noarch 1.1.30-14.el6 rhel-x86_64-server-6 101 k Transaction Summary ================================================================================ Install 1 Package(s) Total download size: 101 k Installed size: 0 Downloading Packages: yum-utils-1.1.30-14.el6.noarch.rpm | 101 kB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : yum-utils-1.1.30-14.el6.noarch 1/1 Installed products updated. Verifying : yum-utils-1.1.30-14.el6.noarch 1/1 Installed: yum-utils.noarch 0:1.1.30-14.el6 Complete!

Syntax

The syntax is:

repoquery -l { package-name-here } repoquery -q -l { package-name-here } repoquery -q -l --plugins { package-name-here } repoquery -q -l --plugins * { package-name-here } * repoquery -l {package-name-here} repoquery -q -l {package-name-here} repoquery -q -l --plugins {package-name-here} repoquery -q -l --plugins *{package-name-here}*

Where,

-l : List files in package

: List files in package -q : For rpmquery compatibility (not needed)

: For rpmquery compatibility (not needed) --plugins : Enable plug-ins support

Examples

To list the contents of a package called htop using yum, run:

repoquery -q -l --plugins htop

Sample outputs:



Equivalent rpm command syntax:

# rpm -ql {packageName}

# rpm -ql htop

# rpm -qlp /path/to/nginx.rpm

To list and match all php packages, enter:

repoquery -q -l --plugins php*

OR (warning may take a long time)

repoquery -q -l --plugins php* | less

A note about Fedora Linux users and dnf command

Fedora latest comes with dnf command. So the syntax is as follows:

# dnf repoquery -l {packageName}

# dnf repoquery -l htop

How to show general information about package

Pass the -i option to the repoquery command:

# repoquery -i {packageNamehere}

# repoquery -i nginx

Sample outputs:

Name : nginx Version : 1.13.8 Release : 1.el7_4.ngx Architecture: x86_64 Size : 2665830 Packager : None Group : System Environment/Daemons URL : http://nginx.org/ Repository : nginx Summary : High performance web server Source : nginx-1.13.8-1.el7_4.ngx.src.rpm Description : nginx [engine x] is an HTTP and reverse proxy server, as well as a mail proxy server.