Debian

How to Check the Version of the Installed Package on Debian

If you’re a Debian user, you know how necessary it is to keep your software up-to-date. Installing the latest version of software packages can help improve the performance, security, and stability of your system. However, before updating a package, you need to know what version is currently installed on your system. There are different commands available through which you can check the installed package version. In this guide, we will discuss those commands in detail.

Check the Version of the Installed Package on Ubuntu/Debian

Following are the methods/commands that can be used to check the version of the installed package on Debian:

Method 1

Depending on the package installed on your system, you can use -v or –version option to check the version of the installed package:

<package_name> --version

 
For example:

firefox --version

 

firefox -v

 

Method 2

apt command has various options and one option is the list. It is used with the package name to check the version of the installed package. The general syntax of the command is:

apt list <package_name>

 
Here I am using the apt list command to check the version of curl utility:

apt list curl

 

Use the flag -a to check all the options available for the specific package in the repository:

apt list curl -a

 

Method 3

The apt-cache is the Debian command line tool that is used to query the APT cache. To get the output of the version of the installed package, run the following command:

apt-cache policy <package_name>

 
Let’s check the version of curl with apt-cache:

apt-cache policy curl

 

In the above image the installed: 7.74.0-1.3+debllu7 shows the version of the curl, if the package is not installed on your system, you will see the none value for an installed option.

Method 4

You can also use the aptitude command-line tool to check for the installed package version on Debian. However, you must first install it on the Debian system from the following command:

sudo apt install aptitude -y

 

Once the aptitude is successfully installed on your system, use the below-mentioned syntax command to get the version of the package.

aptitude versions <package_name>

 
Replace the package with the name of the package you want to check. I am using the aptitude command to check the version of the curl:

aptitude versions curl

 

Method 5

You can also install apt-show-versions command-line utility from the following command to check the version of the installed package on Debian.

sudo apt install apt-show-versions -y

 

Input the name of the package with the apt-show-versions command to get the list of available packages:

apt-show-versions curl

 

Method 6

dpkg is the package manager for the Debian based Linux systems. The dpkg command with the grep and package name will provide the installed version of the package.

dpkg -s <package_name> | grep Version

 
For example:

dpkg -s curl | grep Version

 

Wrap-Up

Knowing the package version before upgrading is important. We can also check the version of the installed package on Debian to confirm the installation. In this guide, we have explained the six different commands to check the version of the installed package on Debian. You can use those commands to check for the installed version of any package on Debian.

About the author

Zainab Rehman

I'm an author by profession. My interest in the internet world motivates me to write for Linux Hint and I'm here to share my knowledge with others.