Shared server guidance · Question & answer

How do I check whether a Linux package is installed and which version it uses?

Use the package database that belongs to the distribution. An installed package version does not always identify the code currently running: a service may need a restart after an upgrade, or a custom binary may take precedence in its executable path. Verify the application separately when diagnosing a version mismatch.

BeginnerDebian/Ubuntu servers using dpkg, or RHEL-family servers using RPM
Go to the answer

Before you start

  • An authorised SSH session on the Linux server.

Instructions

1. Query the appropriate package database

The examples inspect OpenSSH server packages without changing them. Run the Debian/Ubuntu command or the RPM-family command, not both as an installation procedure.

Remote Linux shell
dpkg-query -W -f='${Status} ${Version}\n' openssh-server

Debian/Ubuntu: installed status should include install ok installed; a package record alone is not enough.

Remote Linux shell
rpm -q openssh-server

RHEL-family: the result includes the installed package build; not installed is a normal negative result.

2. Check where the executable comes from

Identify the actual command or service binary used by the application. A binary installed under /usr/local can be independent of the distribution package.

Remote Linux shell
command -v ssh
ssh -V

This example reads the SSH client location and version. The client and server package versions are related but not interchangeable evidence.

Check the result

  • The package database reports the expected installed state, and the relevant application’s own version/status confirms the intended running software.

Troubleshooting

The command works but no package is found
It may be manually installed, bundled with an application, or named differently. Identify the exact executable and its owner before changing packages.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.