I used to install packages by dpkg -i *.deb as I have all deb (with dependencies) in one folder.

Now Is there any Reverse process of dpkg -i *.deb to remove all packages installed from debs.

(dpkg -r <pkgname>is not helpful because it requires package-name instead of deb file and not accept *.deb)


dpkg can extract the package name (with a bit of help). The only serious problem here is just chaining them together and that's where find steps in.

find -iname '*.deb' -exec dpkg --info '{}' \; | awk '/Package:/ {print $2}' | xargs -r -- sudo apt-get remove

That isn't tested but it should work.

  • I tried This and It's Working But dpkg shows error while removing some packages if other packages depends on them. So. I tried "apt-get remove" Instead of "dpkg" -r in that folder Containing Deb's. And It's Working Well. – Pandya Apr 9 '14 at 12:24
  • @Pandya I noticed your edit bounced. Sorry about that. I've altered my answer to account for your comment. – Oli Apr 9 '14 at 13:11

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.