Source for a apt package can be obtained with the command:

apt-get source foo

This produces a directory with four entries in it: a directory of source and three files, foo*****.dsc, foo*****.tar.gz and foo*****.diff.gz.

Assume that the directory of source is corrupted, can these files be used to recreate it? ( As I assume it can. )


| improve this question | | | | |

To re-create the source directory, delete it and run

dpkg-source -x foo...dsc

This will extract everything using the .dsc and the two tarballs (or the tarball and patch as in your example).

| improve this answer | | | | |
  • Which is a thin wrapper around extracting the tar and applying the diff, which can be done manually if necessary. – bahamat Apr 6 '15 at 19:03
  • 1
    Indeed, for old-style packages with a .diff.gz. But other packages can be more complex to extract manually (take a look at libreoffice for example), and dpkg-source handles any Debian source package you can find. – Stephen Kitt Apr 6 '15 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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