Yum: List & Remove all devel packages

mate64 asked:

Devel packages usually contain the headers or other stuff that’s necessary for compiling applications.

To keep the systems clean and manageable, I’m looking for a command to
list all-devel-packages installed by yum (also rpm’s, without the suffix).

I usually use yum list installed and collect the devel’s manually.

Do you recommend to remove them after compilation as a general rule?

My answer:

yum remove $(rpm -qa "*-devel")

Also, don’t do development on your production (or even staging) systems. If you really must rebuild an RPM, use mock which builds it in a chroot and can clean up after itself.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.