How to Check the Version of the Installed Package on Debian

Introduction

Before we begin talking about how to check the version of the installed package on Debian, let's briefly understand – What is an installed package?

If you use Debian, you understand how important it is to keep your software up to date. The stability, performance, and security of your system can all be enhanced by installing the most recent versions of software packages. To update a package, you must first be aware of the version that is already installed on your system.

In this tutorial, you will check the version of the installed package on Debian. WeS will also address a few FAQs on how to check the version of the installed package on Debian.

Ways to Check the Version of the Installed Package on Ubuntu/Debian

The following are some methods or commands that can be used to determine the installed package's version on Debian:

Method 1

You can verify the version of the installed package with the -v or -version option, depending on the package installed on your system:

<package_name> --version

For example:

firefox --version
firefox -v

Method 2

The list is one of the options available with the apt command. It is used in conjunction with the package name to determine the installed package's version. The general syntax of the command is as follows:

apt list <package_name>

In our case, we will use the apt list command to check the version of curl utility:

apt list curl

To view all the options available for a given package in the repository, use the flag -a:

apt list curl -a

Method 3

The Debian command-line utility used to query the APT cache is called apt-cache. Run the following command to get the version of the installed package's output:

apt-cache policy <package_name>

Let's use apt-cache to check the version of curl:

apt-cache policy curl

You will see the none value for an installed option if the package is not installed on your system. The installed: 7.74.0-1.3+debllu7 in the preceding image displays the version of curl.

Method 4

The aptitude command-line utility can also be used to check the installed package version on a Debian system. The following command must first be used to install it on the Debian operating system:

sudo apt install aptitude -y

Once aptitude has been successfully installed on your system, you can obtain the package's version by using the syntax command listed below.

aptitude versions <package_name>

Substitute the package with the name of the package to be checked. To determine the curl version, we will be using the aptitude command:

aptitude versions curl

Method 5

To check the version of a package installed on a Debian system, you may also install the apt-show-versions command-line tool with the following command.

sudo apt install apt-show-versions -y

To view a list of available packages, use the apt-show-versions command with the package name:

apt-show-versions curl

Method 6

The package manager for Debian-based Linux systems is known as dpkg. The installed version of the package can be determined by using the dpkg command with the grep and package name.

dpkg -s <package_name> | grep Version

For example:

dpkg -s curl | grep Version

FAQs to Check the Version of the Installed Package on Debian

Can I use a graphical tool to check package versions on Debian?

Yes, Debian provides a graphical package manager called Synaptic. You can install it using the apt package manager and use it to check the version of installed packages in a more user-friendly way.

How do I list all installed packages along with their versions? 

To list all installed packages along with their versions, you can use the dpkg command with the -l option alone, without specifying a package name. Run: dpkg -l.

Is there a way to display only the version number without additional information? 

Yes, you can use the dpkg-query command with the --showformat option to display only the version number. For example, dpkg-query --show --showformat='${Version}\n' package-name.

How can I check if a specific package is installed on my Debian system? 

To check if a specific package is installed on your Debian system, you can use the dpkg-query command followed by the --list option and pipe the output to grep. For example, to check if curl is installed, run: dpkg-query --list | grep curl.

How do I check if a package is up-to-date or requires an update? 

You can compare the installed package version with the available version in the Debian repositories. Use the apt-cache policy command followed by the package name to check the installed and available versions. If the available version is higher than the installed one, an update is available.

Can I check the version of a package without using the command line? 

Yes, there are web-based package tracking tools available, which provide information about the latest versions of packages in the Debian repositories. You can access these websites to check the current version of a package.

How can I check for updates for all installed packages at once? 

You can use the apt-get command with the upgrade option to check for updates for all installed packages. Running sudo apt-get upgrade will display a list of available updates along with the package versions.

Conclusion

It's crucial to know the package version before updating. To verify the installation, we can also check the Debian version of the installed package. The six different commands to check the installed package's version on Debian are covered in detail in this article. These commands allow you to check Debian for the installed version of any package.

If you have any queries or doubts, please leave them in the comment below. We'll be happy to address them.