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.
vim-8.2.2137-r0 description: Improved vi-style text editor vim-8.2.2137-r0 webpage: https://www.vim.org/ 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: https://www.vim.org/ gvim-8.2.2137-r0 installed size: 29 MiB
As you see, the installed version of Vim is
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
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
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 [installed] 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 <email@example.com> 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
grep command to get the installed version of a package like below.
$ dpkg -s apache2 | grep -i version
To display the extensive information of an installed package, run:
$ dpkg -s apache2
Package: apache2 Status: install ok installed Priority: optional Section: httpd Installed-Size: 488 Maintainer: Ubuntu Developers <firstname.lastname@example.org> 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 Conffiles: /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 <email@example.com>
Also, we can find a package version using
$ apt-show-versions apache2
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
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.