Home Linux Commands How To Find A Package Version In Linux

How To Find A Package Version In Linux

Check Version Of Installed Package In Linux

By sk
Published: Last Updated on 30.4K views

Even though package management has become easier with the help of graphical package managers, some users always prefer the command line way. There are different commands to find out the package version in different flavors of Linux. Today, in this tutorial, we will be seeing how to find a package version in some popular Linux distributions such as Alpine Linux, Arch Linux and its derivatives, Debian and its derivatives, RHEL and its derivatives.

Find package version in Alpine Linux

To view the package version and other details, use apk info command like below.

$ apk info vim

You will see the small description of the given package and it's website where it is hosted.

Sample output:

vim-8.2.2137-r0 description:
Improved vi-style text editor

vim-8.2.2137-r0 webpage:

vim-8.2.2137-r0 installed size:
18 MiB

gvim-8.2.2137-r0 description:
advanced text editor, with GUI

gvim-8.2.2137-r0 webpage:

gvim-8.2.2137-r0 installed size:
29 MiB

As you see, the installed version of Vim is 8.2.

Find package version in Arch-based systems

To find out an installed package(Eg. VLC) version in Arch Linux and its derivatives such as EndeavourOS and Manjaro Linux, run the following command:

$ pacman -Q vlc

Sample output:

vlc 2.2.4-3

As you see in the above output, the installed version of VLC package is 2.2.4-3.

To display the extensive details of a package, run:

$ pacman -Qi vlc

Sample output:

Name : vlc
Version : 2.2.4-3
Description : A multi-platform MPEG, VCD/DVD, and DivX player
Architecture : x86_64
URL : http://www.videolan.org/vlc/
Licenses : LGPL2.1 GPL2
Groups : None
Provides : None
Depends On : a52dec libdvbpsi libxpm libdca libproxy sdl_image
 libdvdnav libtiger lua libmatroska zvbi taglib
 libmpcdec ffmpeg2.8 faad2 libupnp libshout libmad
 libmpeg2 xcb-util-keysyms libtar libxinerama
Optional Deps : avahi: for service discovery using bonjour protocol
 libnotify: for notification plugin [installed]
 gtk2: for notify plugin [installed]

  lua-socket: for http interface
 qt4: for the GUI [installed]
Required By : None
Optional For : smtube
Conflicts With : vlc-plugin
Replaces : vlc-plugin
Installed Size : 53.28 MiB
Packager : Antonio Rojas <arojas@archlinux.org>
Build Date : Sun 24 Jul 2016 03:12:59 PM IST
Install Date : Fri 05 Aug 2016 11:22:54 AM IST
Install Reason : Explicitly installed
Install Script : No
Validated By : Signature

The above command shows the complete details such as package description, version, build date, installed date, and package owner etc.

Find package version in DEB-based systems

In Debian, Ubuntu and its derivatives such as Linux Mint, Pop OS and Elementary OS, we can find the installed a package, Say Apache webserver, version using dpkg command with -l switch like below:

$ dpkg -l apache2

Alternatively, you can use dpkg with grep command to get the installed version of a package like below.

$ dpkg -s apache2 | grep -i version

Sample output:

Version: 2.4.18-2ubuntu3.1

To display the extensive information of an installed package, run:

$ dpkg -s apache2

Sample output:

Package: apache2
Status: install ok installed
Priority: optional
Section: httpd
Installed-Size: 488
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Version: 2.4.18-2ubuntu3.1
Replaces: apache2.2-bin, apache2.2-common
Provides: httpd, httpd-cgi
Depends: lsb-base, procps, perl, mime-support, apache2-bin (= 2.4.18-2ubuntu3.1), apache2-utils (>= 2.4), apache2-data (= 2.4.18-2ubuntu3.1)
Pre-Depends: dpkg (>= 1.17.14)
Recommends: ssl-cert
Suggests: www-browser, apache2-doc, apache2-suexec-pristine | apache2-suexec-custom, ufw
Conflicts: apache2.2-bin, apache2.2-common
 /etc/apache2/apache2.conf da32fcc6a783acaebf0d74c17c726bf7
 /etc/default/apache-htcacheclean ae8721a0bc5b4e2ef7a5258b1e9db5c5


 /etc/logrotate.d/apache2 7322a4f050c1e2454249695236a3472c
 /etc/ufw/applications.d/apache2-utils.ufw.profile f8d4fd920e598ceb4379613c6261f6af
Description: Apache HTTP Server
 The Apache HTTP Server Project's goal is to build a secure, efficient and
 extensible HTTP server as standards-compliant open source software. The
 result has long been the number one web server on the Internet.
 Installing this package results in a full installation, including the
 configuration files, init scripts and support scripts.
Homepage: http://httpd.apache.org/
Original-Maintainer: Debian Apache Maintainers <debian-apache@lists.debian.org>

Also, we can find a package version using apt-show-versions command:

$ apt-show-versions apache2

Sample output:

apache2:amd64/xenial-security 2.4.18-2ubuntu3.1 uptodate
apache2:i386 not installed

As you see in the above result, I have installed apache2 64 bit version, and its version is 2.4.18.

If 'apt-show-versions' program is not installed, you can install it using command:

$ sudo apt install apt-show-versions

We know now how to check the installed package's version. What about the version of a package in the online repositories? Is there anyway to check the version of packages that are available in the official repositories? It's also possible. Check the following link to find out how.

Even if the packages are not installed in your Debian-based systems, you still can find their versions. Check the following guide for more details.

Find package version in RPM-based systems

To find out the version of an installed package (Eg.httpd) in RPM based distributions such Red Hat, CentOS, Fedora, AlmaLinux, Rocky Linux, and openSUSE etc., run:

$ rpm -qi httpd

Sample output:

Name : httpd
Version : 2.4.6
Release : 40.el7.centos.4
Architecture: x86_64
Install Date: Thu 11 Aug 2016 08:08:45 PM IST
Group : System Environment/Daemons
Size : 9806117
License : ASL 2.0
Signature : RSA/SHA256, Mon 18 Jul 2016 09:35:16 PM IST, Key ID 24c6a8a7f4a80eb5
Source RPM : httpd-2.4.6-40.el7.centos.4.src.rpm
Build Date : Mon 18 Jul 2016 09:02:11 PM IST
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://httpd.apache.org/
Summary : Apache HTTP Server
Description :
The Apache HTTP Server is a powerful, efficient, and extensible
web server.

The above command displays the installed package version, build date, license, description etc. As you see in the output, httpd package version is 2.4.6.

You May Also Like


Roman Caecescu November 13, 2021 - 8:06 am

The way to see the version of an installed deb package on Debian systems and derivatives (Ubuntu, Mint etc) is to use dpkg -l (that is an “ell”). There is no need to go to the extra typeing with dpkg -s (which generated lots of output) to invoke a pipeline to grep to get the version.

dpkg -l apache2

sk November 13, 2021 - 12:33 pm

Thank you Roman. Today I learned about -l switch.

Roman Caecescu November 14, 2021 - 9:41 am

Glad to be of some help.

There are so many command line options and switches to the deb command that unless you know about and use a particular feature regularly it is quite a challenge to know what is the appropriate invocation to make. That is why they subsequently developed “wajig” and more recently the new “apt” as frontends to try and simplify and make more user friendly the management of “deb” packages.

So an alternative to dpkg -l with the “new” apt is

apt list apache2


Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More