Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

How to use “Yum history” to find out installed or remove packages

- Advertisement -

Hello, friends. Yum is one of the most important package managers out there because of things like Yum history. So, we will use yum history to find out package information about installed or uninstalled packages on the system. In addition to this, yum history is used to verify transactions that have been made with this program.

Using yum history in Linux

The main reason to use yum and the history sub command is to verify the transactions that the command has performed over time. These transactions can be a joint package update, uninstallation, or an installation. Each of them is identified with an ID for better management.

In addition to this, we can rollback to a previous state or check the history that has been made. It is a marvel that we are going to explain.

Although the options of yum history are several, the most important ones are

  • info: Shows the information about the transactions.
  • list: that allows us to list the transactions made.
  • redo: which repeats the tasks performed in the transaction.
  • undo: Reverses to the previous state of the transaction performed.
  • rollback: In this case, it reverses the configuration of the RPM packages to the previous state of the transaction. It is possible that several may be done to achieve the objective.

With these operations, it is enough to use it.

In this post, I will execute the commands as root user to avoid problems.

Showing transactions with yum history

If you use the command

yum history

Or:

yum history list all
- Advertisement -

You will get an output screen showing you all the transactions that have been performed.

1.- Showing the list of transactions
1.- Showing the list of transactions

The fields on the output screen show the ID, the command itself; the date and time it was performed; the action that was executed; and finally a number indicating affected packages along with a legend.

You can also use list to query the transaction history of a specific package. For example:

yum history list vim-minimal
ID     | Command line                                                                                                       | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     7 | update                                                                                                             | 2022-03-09 20:43 | Upgrade        |   23  <
     1 |                                                                                                                    | 2022-01-24 09:47 | Install        |  391 >E

Show information about a transaction

Using the transaction ID and the ìnfo command, we can display information about the transaction performed.

For example,

yum history info 7
2.- Show info of one transaction
2.- Show info of one transaction

There you will have information about the packages that have been affected.

Likewise, you can specify a package to know the information about the transaction where it has been involved.

Yum history rollback

To demonstrate this, I will first install two packages like nano and vim.

yum install nano vim

If you show again the list of transactions, it will look something like this

yum history
3.- Yum history command
3.- Yum history command

Now we have to rollback to a state before installing nano and vim.

yum history rollback 7
4.- Rollback command
4.- Rollback command

That is, it will go back to the state before the last transaction so nano and vim will be removed.

To redo a transaction, you can use redo in the same way as Rollback. The difference is that redo will redo everything the transaction has done.

Now the undo option

About the undo option the operation is similar to rollback, so you only have to use

yum history undo 7

But as we have said, they are used in a very similar way.

Conclusion

Yum history is a very useful utility to know and manage the transactions that have been done in YUM. In addition to this, it can be used to keep track of changes in packages.

I hope you liked this post.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook

x