Yum command in Linux is the default package manager for RPM packages on RHEL & CentOS. And most of you working on these OS should be familiar with it (for those of you who are not, read our article Working with Yum Commands ).

In this article, we are going to discuss some Yum tips & tricks that we normally don't know or use but are pretty useful.

Recommended Read: How do i install RPM packages on Ubuntu ???

Also Read: Package management in Ubuntu : Learn dpkg command with examples


Downgrade a package

You might have come across this issue or might run into someday, where you have upgraded a package that was not meant to be upgraded or you have upgraded a package with good intentions but it's causing you some trouble.

With the YUM command in Linux, we have the option to downgrade a package to the previous version, just open your terminal & execute the following command,

$ yum downgrade package_name

yum tips tricks

( Also Read : 5 ways to change HOSTNAME in RHEL/CentOS 7 )

Yum shell

This yum tip is actually known to pretty few. We can actually start a Yum Shell & use it to manage packages. To start the yum shell, open the terminal & type

$ yum shell

Now shell for yum will be started & we can run all the shell command minus the yum at the beginning. For example 'search package_name'

yum tips tricks

 

Install only security updates

To actually do this, we need to install a plugin called 'yum-plugin-security'. We don't need to install this plugin on RHEL 7, as it's already part of yum. To install the plugin on RHEL 6, execute the following command,

$ yum install yum-plugin-security

Once the plugin has been installed, we can check the list of errates by executing the following command,

$ yum updateinfo list available

yum command in linux

To check all available security updates, run

$ yum updateinfo list security all
$ yum updateinfo list sec

To install only the errata updates, run

$ yum update-minimal --security -y

To download & apply all the security updates, run

$ yum update --security -y

 

Check when the package was installed/updated

Though technically it's not one of the yum tips tricks but rather an RPM one nonetheless, it's pretty useful & comes in handy at times. We can check when a package has been installed or when its was last updated by running the following command,

$ rpm -qa --last

yum command in linux

To know when a particular package has been installed, execute the following command,

$ rpm -q package_name --last

These were some yum tips & tricks (& one rpm trick) to help you out. Please send in your suggestions or queries to us using the comment box below, we will surely address them.

We are giving you exclusive deals to try Linux Servers for free with 100$ credit, check these links to claim your 100$,

DigitalOcean - 100$ free credit & Linode - 100$ free credit

Check some Exclusive Deals, HERE.

Also, check out DevOps Book You should read section.