How to find a package version in Linux
Have you ever wondered how to find the version of an installed package in Linux? Of course, you are. Nowadays, Package management is much more better than before, with the help of many graphical package managers. However, I always prefer the command line to get things done faster and easier. There are different commands available to find out the package version in different flavours of Linux. Today, in this tutorial, we will be seeing how to find a package version in some popular Linux distributions such as Arch Linux and its derivatives, Debian and its derivatives, RHEL and its derivatives.
Find a package version in ARCH based systems
To find out an installed package(Eg. VLC) version in Arch Linux and its derivatives such as Antergos, Manjaro, 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.
Also read – Pacman command usage
Find a package version in DEB based systems
In Debian, Ubuntu and its derivatives such as Linux Mint, Elementary OS, we can find the installed package(Apache webserver) version using command:
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 command:
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 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.
Find a package version in RPM based systems
To find out the version of an installed package (Eg.httpd) in RPM based distributins such Red Hat, CentOS, Fedora, Scientific 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.
That’s all for now. Hope this helps. If you find this guide useful, please share it on your social networks and support OSTechNix.