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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to add and remove packages at the same time with a single yum command? For example, installing postfix and removing sendmail without running two separate commands/transactions.

share|improve this question
Not to my knowledge, but I'm not a daily yum user. Why do you want it in a single command? – jippie Jun 2 '12 at 16:39
@jippie Convenience, mostly. And reducing the time to set up multiple transactions. – Michael Ekstrand Jun 2 '12 at 16:43
up vote 13 down vote accepted

Yes. Invoking yum shell will allow you to specify multiple commands that will happen simultaneously when run is entered.

share|improve this answer
Awesome, this is exactly what I was looking for. – Michael Ekstrand Jun 2 '12 at 20:01
I had originally been using Python for this. I've now cut my script down to about 20% the size by using BASH! – quickshiftin Mar 17 '14 at 18:38

Newer versions of yum also have the swap command:

# yum swap -- install foo -- remove bar
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.