97

If I want to check available versions of a package in Debian, I run apt-cache policy pkgname which in the case of wajig gives:

wajig:
  Installed: 2.01
  Candidate: 2.01
  Version table:
 *** 2.01 0
        100 /var/lib/dpkg/status
     2.0.47 0
        500 file:/home/wena/.repo_bin/ squeeze/main i386 Packages
        500 ftp://ftp.is.co.za/debian/ squeeze/main i386 Packages

That means that there are three wajig packages, one that is installed (/var/lib/dpkg/status), and two others (which are the same version). One of these two is in a local repository and the other is available from a remote repository.

How do I achieve a similar result on rpm systems?

5 Answers 5

117

yum For RHEL/Fedora/Centos/Scientific Linux

Provides the command list to display information about installed and upgradeable (and older) packages.

yum --showduplicates list <package>

zypper For SuSE Linux

Can return a detailed list of available and installed packages or patches.

zypper search -s <package>

Adding --exact-match can help, if there are multiple packages.

As a side-note, here is a comparison of package-management commands.

2
  • 9
    You should also add --showduplicates to yum if you want to see ALL available versions, not just the latest. Jan 9, 2017 at 4:14
  • the --exact-match option does not seem to be available for yum nor for zypper...
    – Chris Maes
    Mar 1, 2019 at 12:49
23

You can use rpm -qi <package name> to have all information of installed package. You can use below commands as well:

yum info <package name>
yum list <package name>
yum --showduplicates list <package name>
1
  • 2
    All except the last one there just display information about the "installed" version FWIW. But the --showduplicates one works, thanks!
    – rogerdpack
    Aug 16, 2017 at 16:21
7

The other answers addresses how to get information about the installed packages on the system. To add to that, it is also possible to query the yum repository about available not yet installed packages in addition with the pkcon search command from PackageKit, e.g.

$ pkcon search name xz
Searching by name             [=========================]         
Starting                      [=========================]         
Querying                      [=========================]         
Available       pxz-4.999.9-2.beta.20100608git.fc15.i686        Parallel LZMA compressor using XZ
Installed       xz-5.0.3-1.fc15.i686                            LZMA compression utilities
Available       xz-compat-libs-5.0.1-2.fc15.i686                Compatibility libraries for decoding LZMA compression
Available       xz-compat-libs-5.0.3-1.fc15.i686                Compatibility libraries for decoding LZMA compression
Installed       xz-debuginfo-5.0.3-1.fc15.i686                  Debug information for package xz
Installed       xz-devel-5.0.3-1.fc15.i686                      Devel libraries & headers for liblzma
Installed       xz-libs-5.0.3-1.fc15.i686                       Libraries for decoding LZMA compression
Installed       xz-lzma-compat-5.0.3-1.fc15.i686                Older LZMA format compatibility binaries
Installed       xzgv-0.9.1-3.fc15.i686                          Picture viewer
$

I assume PackageKit is written generic so that it works with apt repositories as well, although I have only experience from using it on my Fedora systems.

4

Running the below commands shall give you all the installed packages on the server.

rpm -qa | grep <packagename>

More rpm commands are listed here

1
  • Thanks. Yum mirror list is inaccessible and I just wanted to check the version of a package. I haven't used this form in so long I forgot the args! Feb 29, 2020 at 21:33
3

To query the available packages, you can do urpmq --sources YOURPACKAGE This is Mandriva-specific (I only know Mandriva).

If you want to know the version of an installed package : rpm -q YOURPACKAGE This works on all RPM systems.

On RedHat/Fedora, see yum.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.