59

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?

77

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.

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

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>
  • 2
    All except the last one there just display information about the "installed" version FWIW. But the --showduplicates one works, thanks! – rogerdpack Aug 16 '17 at 16:21
5

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.

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.

3

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

rpm -qa | grep <packagename>

More rpm commands are listed here

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.