Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When building packages for internal company projects, sometimes we loose track of the package source and only have the binary .deb. Even worse, the package builder may install it onto a production system but forget to drop it in yum and later leave the company. Some point in the future we need to build a new server and want to ensure that the .deb we found in the engineer's home directory exactly matches the one on existing servers. Is there a way to find out if the .deb is the exact same one?

On rpm based systems I would do the following

old-server$ rpm -qi foo

new-server$ rpm -qi -p foo-1.2.3.rpm

and compare the size, build date, build host and if they match, then I know I have the exact rpm I need.

Is there an equivalent way of doing this on dpkg based systems?

I see that dpkg-query can return an MD5 of some data, but the manual page says it's related to dselect and I'm unable to get any data from it.

share|improve this question

You could do a dpkg -l <packagename> and see if the package is installed and what version it is. This may not work if you don't have some sort of guidelines for version numbers and such (eg. when making changes to the code and releasing/installing, you should bump the version number)

share|improve this answer

I guess comparing the installed files on the system with the files inside the package should give you a good idea? You can extract files from a *.deb with dpkg -x <deb-filename> <directory-to-extract-in> and you can list all files installed by an installed package with dpkg -L <package-name>.

When you have this info, you should be able to compare filenames, file dates, checksums, or whatever you want...

share|improve this answer
If using md5 sums, as the most part of packages do, it is even quickier – enzotib Nov 1 '11 at 20:20
How to best use the md5 sums that are part of the package? Is there a way to get a list of checksums from an installed and uninstalled package? – Blair Zajac Nov 4 '11 at 4:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.