Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

I just went through this question and was wondering whether there was a better way to re-create the binary of an installed package, which got deleted somehow.

I know I can reinstall the application, but re-installing the complete package isn't necessarily feasible always.

P.S.: I am talking about an installed application, so please assume that I don't have the source code(it may be open-source but I don't want to procure the exact source code of the installed version).

share|improve this question
up vote 2 down vote accepted

Well, DEB packages are extractable!

So, you can simply download the DEB package, extract it, take the binary from it and place it where it should be inside your system (this is visible from the DEB's structure, anyway).

For example, let's say that you're missing a binary file.

Download the DEB package using this script:

URI=$(apt-cache show $PACKAGE | grep "Filename:" | cut -f 2 -d " ")

It takes as argument the package.

Then, you extract the package and you will see a usr folder and inside it a bin folder (this is usually where the binary package is being installed). So, you copy this binary file to /usr/bin and you are done.

Be careful NOT to download later versions of the package than the one that you had installed in your system in order to avoid incompatibility problems!

EDIT: After a constructive comment by chaos please note that if you have already installed the package in your system then you can find it in /var/cache/apt/archives/. Taking the package from there is a good idea, because you can be sure about the incompatibility issues.

share|improve this answer
If it's a previously installed program you may have the .deb package still in the /var/cache/apt/archives/ folder. Anyway +1 good answer. – chaos Nov 13 '13 at 13:01
Thanks, answer edited. – hakermania Nov 13 '13 at 13:03

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.