uninstall packages using dpkg

41,932

Solution 1

Actually dpkg does not support wildcards So if you need that feature you need this

dpkg --get-selections | grep "open-office" >list.txt

this file contains package and status you need to parse it and then feed to dpkg

Solution 2

You can use

sudo apt-get purge openoffice.org-base-core openoffice.org-common openoffice.org-core openoffice.org-style-human uno-libs3 ure openoffice.org-thesaurus-en-au openoffice.org-thesaurus-en-us openoffice.org-hyphenation openoffice.org-hyphenation-en-us openoffice.org-l10n-common

to purge the packages.

Running the wildcard will remove following too:

aspell* aspell-en* dictionaries-common* hunspell-en-ca* hunspell-en-us* language-support-en* language-support-writing-en* myspell-en-au* myspell-en-gb* myspell-en-za* openoffice.org-base-core* openoffice.org-calc* openoffice.org-common* openoffice.org-core* openoffice.org-draw* openoffice.org-emailmerge* openoffice.org-gnome* openoffice.org-gtk* openoffice.org-help-en-us* openoffice.org-impress* openoffice.org-math* openoffice.org-style-human* openoffice.org-writer* python-uno* wbritish*

Using above is the safe way.

Solution 3

One-liner to delete multiple packages with dpkg by wildcard:

dpkg --list|grep openoffice|awk '{ print $2 }'|xargs sudo dpkg -r
Share:
41,932

Related videos on Youtube

s.m
Author by

s.m

Updated on September 18, 2022

Comments

  • s.m
    s.m almost 2 years

    I want to uninstall openoffice package and want to do this using single command or regular expression i.e

    dpkg -r openoffice-org*
    

    but dpkg doesnot accept wild cards

    how can i uninstall all the packages using wildcard

    • carnendil
      carnendil over 11 years
      The wild-card should work. Check whether you are typing openoffice.org or openoffice-org. Still, you would have to type the names of other packages, e.g. uno-libs3, ure
    • s.m
      s.m over 11 years
      It doesnot work I have tried to remove evolution using sudo dpkg -P evolution* dpkg warning: ignoring request to remove evolution* which isn't installed
    • αғsнιη
      αғsнιη almost 10 years
      Did you test with dpkg -r 'openoffice.org*'? or even dpkg -r openoffice.org\*? "also replaced '-' with '.' "
  • s.m
    s.m over 11 years
    I tried apt-get but when I tried that it tries to connect to internet and also install other packages , but i want to perform this where there is no internet connection. Also I can remove openoffice packages using dpkg -P package1 package2 package3 , but I want to remove packages without having to type all the package names
  • Frederik Spang
    Frederik Spang over 11 years
    dpkg doesn't support wildcards. So you'll have to do so. Or copy my list.
  • αғsнιη
    αғsнιη almost 10 years
    @FrederikSpang Why dpkg not support wild cards ^^? do you have any proof or reason?
  • Faizan Akram Dar
    Faizan Akram Dar over 9 years
    apt-get will try to access internet only when you use apt-get install or apt-get update , etc but apt-get remove --purge doesnt need internet access
  • h0ch5tr4355
    h0ch5tr4355 over 8 years
    Not even for apt-get install internet is obsessive - local mirror e.g.