Take the 2-minute tour ×

I want to uninstall libreoffice. This program consists of about three dozen modules. Ideally, they could be removed with:

aptitude remove libreoffice3.6* libreoffice-debian-menus libobasis3.6-*

but that fails with

Couldn't find any package whose name or description matched "libreoffice3.6*"


How do I delete a set of packages by pattern?

PS: I'm happy about answers with use dpkg or apt, too

share|improve this question
Are you trying to know the answer about certain pattern or happy with the removal of LibreOffice components? –  Anwar Shah Apr 4 '13 at 7:39
possible duplicate of How to uninstall LibreOffice? The answer is probabaly: this only works for 3.6 and you are not using 3.6 :-) –  Rinzwind Apr 4 '13 at 7:44
I'm using libreoffice as an example because it contains so many parts. But I had the same problem with the kernel (cleaning up old versions) –  Aaron Digulla Apr 4 '13 at 12:12

2 Answers 2

up vote 6 down vote accepted
  1. Use apt-get, not aptitude, and use regular expressions.

  2. In a regular expression, . mean any character, and * means zero or more times. So the expression libreoffice.* matches any package name containing the string libreoffice, followed by any number of characters.

  3. Surround the regular expression with single quotes to avoid the shell interpreting the asterisk. (If you had a file named libreoffice.example for example in your current directory, the shell would replace libreoffice.* with libreoffice.example, so you have to use single quotes to stop this behaviour.)


sudo apt-get remove 'libreoffice.*'
share|improve this answer
Thanks, this works. Interestingly enough, it also works with the pattern libreoffice* (i.e. glob style patterns) which confuses me a bit because either of them shouldn't work :-) –  Aaron Digulla Apr 4 '13 at 12:09
For those who want to test this, use the option --dry-run to see what would be deleted without any changes to the system. –  Aaron Digulla Apr 4 '13 at 12:11
@AaronDigulla Didn't know about --dry-run yet. That will come in handy! Thanks! –  Glutanimate Apr 4 '13 at 14:33
apt-get is pretty bad handling regular expressions too, compare both solutions in this answer. –  Braiam Mar 31 at 2:42

Aptitude has support for global patterns, and another pretty cool matches like this:

aptitude remove '?and(?name(libreoffice), name(3.6), ~i)' libreoffice-debian-menus

This will match any package that has in it's name libreoffice and 3.6 and also it's installed (that's what the ~i stands for.

share|improve this answer

Your Answer


