0

is there a way to remove multiple deb packages at a time. I have a little under a hundred deb packages. I went to the directory with all the deb files, and I ran the command below.

sudo dpkg -r *.deb

I got this error:

dpkg: error: you must specify packages by their own names, not by quoting the names of the files they come in

Am I doing something wrong, or is there really no way to remove deb packages without doing it one at a time?

3 Answers3

0

dpkg -r command is used to remove installed packages,

And looking at the format .deb it looks like you are just trying to delete .deb files

to delete those you just need to use the simple rm command

rm *.deb
visdev
  • 26
  • 4
0

"remove multiple deb packages at a time" litteraly means removing these .deb files. This is simply done using a rm *.deb command.

If, however, your real intent is to remove all packages that have been installed using these .deb files, then i does not work the way you think. .deb files only install packages, they are not used to remove them. Instead, packages installed in the system are removed by e.g. apt remove <packagename>.

Your .deb files still can be usefull to create a list of the packages they may have installed.

  • If the file is named according to the conventions, the first part of the file name will tell you the name of the installed package.

  • More reliable, however, is to obtain the package name using the dpkg --info <packagename> command.

This can be automated for multiple files using the standard shell tools, but allow me to leave this as your homework.

vanadium
  • 88,010
0

You should use package names with dpkg -r, not .deb file names.

The error message is quite informative.

Pilot6
  • 90,100
  • 91
  • 213
  • 324