Remove packages from a list of .deb files

I have installed a set of Linux packages from a directory of .deb files. I then wanted to uninstall them, but trying to guess the package names was hard – even harder was wading through the sheer amount of files to remove them! Linux has this weird thing where you can installed from anyrandomname.deb file, but you have to remove by package name.

A bit of Googling and some short script work got me this:


for f in *.deb;
 pak="$(dpkg-deb -f "$f" Package)";
# echo $pak $pak
 sudo apt-get remove $pak ;

Every deb file is listed, examined and the packages listed then uninstalled by package name. While there may be more elegant ways, this seems to work!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s