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

2 Answers 2

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 install '^mate !-dev$'
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.