How can I use zypper
to list the locations of installed files for a given package?
4 Answers
rpm can be used to list installed files from a package <package>
with:
rpm -ql <package>
long version:
rpm --query --list <package>
zypper does (at the moment) not support listing installed files.
Also, I find the "reverse" helpful. To find the package "owning" a file <file>
you can use
rpm -qf <file>
returning the exact package.
In openSUSE, there are a few ways of listing installed files. With Zypper, I would try:
zypper search -i
Or:
zypper search --installed-only
With RPM, you can try:
rpm -ql packageName | less
-
9That lists the installed packages. What I need is the list of files installed by a package.– a06eCommented Oct 14, 2014 at 19:11
-
-
19zypper suggestion still lists packages not installed files Commented Jan 5, 2015 at 20:01
As I cannot add comments, I'll add another answer and try to summarize it up properly, because the answers are nearly complete but scattered.
With zypper alone it is not possible, but as the package is installed by zypper, it is usually on your hard drive. If it is not on hard drive anymore, you can even just download it using zypper, without having to reinstall:
zypper in --download-only <package_name>
The package name that is downloaded is then shown. Usually, it is the last package name, because dependencies are retrieved first (e.g. firewalld-0.7.5-1.1.noarch.rpm for package firewalld). To find the directory you could simply use find like so:
find /var/cache/zypp -name <package_name>
It should return a single line with the full path to the file (e.g. /var/cache/zypp/packages/repo-oss/noarch/firewalld-0.7.5-1.1.noarch.rpm). When you found the package and know its path, you can then use rpm:
rpm -ql <path_to_package>
What rpm then lists is the content of the package, including the paths where those files will be installed on your system or have already been installed on your system.
Late answer, but one other option is if you happen to be using openSUSE, there is a tab that shows the files installed by a package in the Yast2 Software Manager.
You can sort of get (some of) the files out of Zypper with this command:
zypper if --provides <packagename>
That lists what all you get with the package. Usually, not very elaborate, and doesn't include the libaries, but I don't know what your use case it, and it might be enough.
E.g.
~$ zypper if --provides util-linux
Loading repository data... Reading installed packages...
Information for package util-linux:
-----------------------------------
Repository : openSUSE-Tumbleweed-Oss
Name : util-linux
Version : 2.39-3.1
Arch : x86_64
Vendor : openSUSE
Installed Size : 4.2 MiB
Installed : Yes
Status : out-of-date (version 2.39-2.1 installed)
Source package : util-linux-2.39-3.1.src
Upstream URL : https://www.kernel.org/pub/linux/utils/util-linux/
Summary : A collection of basic system utilities (core part)
Description :
This package contains a large variety of low-level system utilities
that are necessary for a Linux system to function. It contains the
mount program, the fdisk configuration tool, and more.
Provides : [27]
/bin/su
/bin/kill
/bin/more
/bin/mount
/bin/umount
util-linux(fake+no-canonicalize)
config(util-linux) = 2.39-3.1
eject = 2.1.0
fsck-with-dev-lock = 2.39
hardlink = 1.1
login = 4.0
rfkill = 0.5
util-linux = 2.39-3.1
util-linux(x86-64) = 2.39-3.1
/usr/bin/getopt
/usr/bin/ipcrm
/usr/bin/ipcs
/usr/bin/kill
/usr/bin/more
/usr/bin/mount
/usr/bin/renice
/usr/bin/setpriv
/usr/bin/su
/usr/bin/umount
/usr/sbin/nologin
/usr/bin/col
/usr/sbin/agetty
zypper info PACKAGE_NAME
, but doesn't list the installed files. Any suggestions?