99

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?

tshepang
  • 65,642

5 Answers5

124

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.

rogerdpack
  • 1,715
wag
  • 35,944
  • 12
  • 67
  • 51
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>
Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
moshtagh
  • 339
  • 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
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.

hlovdal
  • 661
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

jasonwryan
  • 73,126
ronak
  • 149
  • 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! – Brian Topping Feb 29 '20 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.

ofaurax
  • 213