How to List All Files Installed by a YUM Package (Equivalent to dpkg -L in Debian)


4 views

When working with RPM-based systems like Scientific Linux 6, you'll often need to inspect which files were installed by a specific package. The Debian-equivalent command dpkg -L doesn't directly translate to YUM, but we have several effective alternatives.

The most straightforward method is using the rpm command directly:

rpm -ql package-name

For example, to list all files installed by the httpd package:

rpm -ql httpd
/etc/httpd
/etc/httpd/conf
/etc/httpd/conf.d
/etc/httpd/conf.d/README
/etc/httpd/conf.d/welcome.conf
/etc/httpd/conf/httpd.conf
...

If you prefer using yum directly, you can combine it with rpm:

yum install -y yum-utils  # First install useful utilities
repoquery -l package-name

For comprehensive package metadata including file lists:

yumdb get files package-name

While dpkg -L shows files from installed packages, remember that YUM/RPM systems have slightly different behavior:

  • Shows absolute paths (like dpkg)
  • Includes directory entries
  • Lists all files regardless of current existence

Let's say you found /etc/nginx/nginx.conf and want to know which package owns it:

rpm -qf /etc/nginx/nginx.conf
nginx-1.14.1-9.el7_9.x86_64

Then to see all files from this package:

rpm -ql nginx-1.14.1-9.el7_9.x86_64

For examining package contents without installing:

yumdownloader package-name
rpm2cpio package-name.rpm | cpio -t

When working with different Linux distributions, it's crucial to know how to inspect package contents. While Debian/Ubuntu users are familiar with dpkg -L, RPM-based systems like Scientific Linux 6 (and its RHEL/CentOS cousins) require different tools.

In yum-based systems, you can use the following command to list all files installed by a package:


rpm -ql package_name

For example, to list all files installed by the httpd package:


rpm -ql httpd

While rpm -ql is the direct equivalent, you can also combine yum with rpm for a more convenient workflow:


yum install -y yum-utils
repoquery -l package_name

Example with the vim-enhanced package:


repoquery -l vim-enhanced

Here are some related commands that might be helpful:


# List all installed packages
rpm -qa

# Find which package owns a specific file
rpm -qf /path/to/file

# Show package information
rpm -qi package_name

Let's walk through a complete example of examining the openssh-server package:


# First install the package if not already present
yum install -y openssh-server

# Then list all files
rpm -ql openssh-server

# Alternatively using repoquery
repoquery -l openssh-server

This will display all configuration files, binaries, documentation, and other files installed by the SSH server package.

The rpm -ql command is generally faster than repoquery -l as it queries the local database directly. However, repoquery offers more flexibility when working with packages not yet installed on the system.