Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I want to install all MATE packages,

$ sudo apt-get install '^mate'

However, it selects too many packages, and some packages are conflicted with some installed ones.

Now, I want to exclude them. Any idea?

No surprise, this won't work:

$ sudo apt-get install '^mate && !-dev'

Or, can I simply let apt-get ignore those conflicted packages?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

You could try something like:

list="" ; for pkg in $(apt-cache search ^mate | grep -v -- '-dev'); list="$list $pkg" ; done ; sudo apt-get install $list
share|improve this answer
apt-cache search doesn't support ^, well, maybe shorter? sudo apt-get install $(apt-cache search ^mate | grep ^mate | grep -v -- '-dev' | cut -d' ' -f1) – Xiè Jìléi Aug 5 '12 at 4:04
ah, thanks. i was working off memory, without an 'apt' using system to test on right now. :) – Tim Kennedy Aug 6 '12 at 4:18

You can only pass a regular expression as an argument to apt-get install.

You can make a regular expression that does what you want, but it's tedious. The negation of a regular expression can be expressed with a regular expression, but the size of the complement regex grows exponentially with the size of the original in general.

apt-get install '^mate(.?.?.?|.*([^v]|[^e]v|[^d]ev|[^-]dev))$'

You can use Aptitude's search patterns to generate the list of packages with a semi-decent syntax, and pass the resulting list to apt-get install or aptitude install.

aptitude search '^mate !-dev$'
share|improve this answer

I have asked the question myself as well. I tried negative lookaheads, but apt-get didn't understand them. So i searched for another way, to archive the same result and found the answer here. Nonetheless, since the choosen solution uses grep, you can use lookaheads and shorten the serach expression, in terms of calls, even more:

apt-cache search '^mate' | grep -P '^mate(?!.*dbg)(?!.*dev).*'

And keep in mind that Mates packages, such as atril, don't start with a mate at the beginning of their name. They don't even contain it at all.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.