What's the equivalent of rpm -qc PACKAGE_NAME in Ubuntu?

# rpm -qc PACKAGE_NAME  

lists the configuration files contained in that RPM package, in a Red Hat-like OS. What's it's equivalent command in an Ubuntu/Debian-based OS?


Solution 1:

Edit:

You can use the following command:

dpkg-query --show -f '${Conffile}\n' package.rpm

Alternatively you can convert the .rpm to a .deb file. You will need to run this command to install alien and other necessary packages:

sudo apt-get install alien dpkg-dev debhelper build-essential

To convert a package from rpm to debian format, use:

sudo alien packagename.rpm

Once in .deb format you should be able to open/extract with archive utility. If you want to install the newly converted .deb to your system run:

sudo dpkg -i packagename.deb

Solution 2:

If you want to use the output for a script and need this to output just the configuration files, I'd try dpkg-query like in the answer from bleeves.

If you don't mind if there's extra information however, dpkg --status PACKAGE_NAME is a simpler choice. It will print pretty much all the information there is about an installed package. (The exception is the complete list of installed files for that package. But that is available via dpkg --listfiles PACKAGE_NAME.) So it's an equivalent to most rpm -q commands for an installed package, at least when meant for human consumption. In this case, you're looking for the conffiles section.

Example output:

$ dpkg --status base-files
Package: base-files
Essential: yes
Status: install ok installed
Priority: required
Section: admin
Installed-Size: 433
Maintainer: Ubuntu Developers <[email protected]>
Architecture: i386
Multi-Arch: foreign
Version: 7.2ubuntu5.1
Replaces: base, dpkg (<= 1.15.0), miscutils
Provides: base
Pre-Depends: awk
Breaks: initscripts (<< 2.88dsf-13.3), sendfile (<< 2.1b.20080616-5.2~)
Conffiles:
 /etc/debian_version 142012ca081ab0981cdcc1ac6db77c34
 /etc/dpkg/origins/debian 731423fa8ba067262f8ef37882d1e742
 /etc/dpkg/origins/ubuntu ea35901c45553c3451f60476be94d2d8
 /etc/host.conf 89408008f2585c957c031716600d5a80
 /etc/issue 46f9e5ee59e4c34c7e0fa6038d081966
 /etc/issue.net 44eb23df696ad5ef26a2f3836671c14a
 /etc/legal 0110925f6e068836ef2e09356e3651d9
 /etc/lsb-release 30c373a51f59c87d55f6e03c946d2962
 /etc/os-release 3ce55484c383d7de3862bf2f2f2f6490
 /etc/update-motd.d/00-header 4a1e6eed7a59f200b4267085721750a3
 /etc/update-motd.d/10-help-text 5064fb57493325202dded183ab0c4ebd
Description: Debian base system miscellaneous files
 This package contains the basic filesystem hierarchy of a Debian system, and
 several important miscellaneous files, such as /etc/debian_version,
 /etc/host.conf, /etc/issue, /etc/motd, /etc/profile, and others,
 and the text of several common licenses in use on Debian systems.
Original-Maintainer: Santiago Vila <[email protected]>