deb-version - Linux


Overview

The deb-version command displays the version of a Debian package or a Debian package file. It is commonly used to retrieve the version information of installed packages or to verify the version of a package before installation.

Syntax

deb-version [options] <package-name> [<package-file>]

Options/Flags

  • -v, –verbose: Displays additional information, including the package description, architecture, and dependencies.
  • -h, –help: Displays the command help screen and exits.
  • –version: Displays the deb-version version and exits.
  • -f, –file: Specifies the path to a Debian package file to retrieve the version from.

Examples

Getting the version of an installed package

deb-version dpkg

Getting the version from a Debian package file

deb-version --file /path/to/package.deb

Displaying verbose information

deb-version -v apache2

Common Issues

Error: No such package available

This error occurs when the specified package is not installed or does not exist. Check the package name and ensure that it is installed.

Error: Failed to open package file

This error occurs when the specified package file is invalid or cannot be opened. Make sure the file exists and is a valid Debian package.

Integration

deb-version can be used in conjunction with other commands, such as apt-get and dpkg, for advanced package management tasks.

Example: Checking if a package is up-to-date

if deb-version <package-name> | grep "$(apt-cache policy <package-name> | grep Installed)" > /dev/null; then
  echo "Package is up-to-date"
else
  echo "Package is not up-to-date"
fi

Related Commands

  • apt-get: Package manager for Debian and Ubuntu-based systems.
  • dpkg: Package management tool for Debian and Ubuntu-based systems.
  • rpm: Package manager for Red Hat Enterprise Linux and Fedora-based systems.