Check Package Version Ubuntu - How To Guide

Determining Package Versions on Ubuntu
Ubuntu’s package management system streamlines the installation and removal of software. However, identifying the specific version of an installed package is sometimes necessary.
The apt-get utilities function as a user interface for the underlying dpkg utility, which handles the actual package management operations.
Using dpkg to Check Package Versions
The dpkg utility allows you to determine the installed version of a package. The command to use is as follows:
dpkg -s
This command provides detailed information about the package, including its version.
Example: Checking the Ruby Version
Consider a scenario where you need to ascertain the Ruby version installed on your Ubuntu system. Here’s how you would use the dpkg command:
geek@ubuntuServ:~$ dpkg -s ruby1.8Package: ruby1.8Status: install ok installedPriority: optionalSection: interpretersInstalled-Size: 272Maintainer: Ubuntu Core DevelopersArchitecture: i386Version: 1.8.4-5ubuntu1.2Depends: libc6 (>= 2.4-1), libruby1.8 (>= 1.8.4)Suggests: ruby1.8-examples, rdoc1.8, ri1.8Description: Interpreter of object-oriented scripting language Ruby 1.8Ruby is the interpreted scripting language for quick and easy object-oriented programming. It has many features to process text files and to do system management tasks (as in perl). It is simple, straight-forward, and extensible..This package provides version 1.8 series of Ruby..On Debian, Ruby 1.8 is provided as separate packages. You can get full Ruby 1.8 distribution by installing following packages..ruby1.8 ruby1.8-dev ri1.8 rdoc1.8 irb1.8 ruby1.8-elisp ruby1.8-examples libdbm-ruby1.8 libgdbm-ruby1.8 libtcltk-ruby1.8 libopenssl-ruby1.8 libreadline-ruby1.8Original-Maintainer: akira yamada
As demonstrated, the output clearly indicates that version 1.8.4 of Ruby is currently installed on the system.
Using dpkg -s provides a straightforward method for verifying the versions of packages installed on your Ubuntu environment.