How To Use The YUM History Command

The  yum history command in Linux is used to view and manage the history of package transactions performed with the YUM package manager. Here’s a breakdown of how to use it:

Basic Usage:

Viewing History:
To view the history of YUM transactions, you can simply run:

yum history

Viewing Detailed History:
To view detailed information about a specific transaction, including which packages were installed, updated, or removed, use:

yum history info <transaction_id>

Undoing or Rolling Back Transactions:
You can undo or rollback a specific transaction using:

yum history undo <transaction_id>

Repeating or Redoing Transactions:
To repeat or redo a specific transaction, you can use:

yum history redo <transaction_id>

YUM history command Parameter Detail

YUM history command

The yum history command contains several subcommands that are available to use. Here is a brief list of what these subcommands can do.

  • Info – Provides detailed information about the last update or the update ID you specify.
  • List – Provides a list of the past updates.
  • Packages-list – Takes a package name, and provides a list of all the update IDs where that package was accessed.
  • Packages-info – Takes a package name and provides the historic update information on that package for the current server.
  • Summary – The summary provides an overview of all the transactions that have happened over the last three months.
  • Addon-info – View any additional information about a transaction ID.
  • Redo – This command repeats the work completed in a particular transaction ID.
  • Undo – This command reverses the earlier work done in a specific transaction ID.
  • Rollback – This command rolls back the RPM’S to their previous configuration. This option can operate on multiple transactions to roll back instead of a single ID.
  • New – Wipes out the current yum history to provide a fresh, blank history file. (Only use this if you have a problem with yumdb/rpmdb.)
  • Sync – Updates the rpmdb/yumdb data stored for any installed packages to what is current in the repo.
  • Stats – Provides statistics about the current history DB.

Additional Options:YUM history command

Filtering History:
You can filter the history by specifying options such as –list, –installed, –removed, –upgraded, –recent, etc., to view specific types of transactions.

Listing Available Transactions:
You can list available transactions with their IDs and other details using:

yum history list

Limiting Number of Transactions Displayed:
You can limit the number of transactions displayed with the –limit option. For example:

yum history list --limit=<number>

Searching History:YUM history command
To search the history for specific packages or keywords, you can use the grep command in combination with yum history list.

Example Usage:

To view the list of recent transactions:

yum history list --recent

To view detailed information about a specific transaction with ID 10:

yum history info 10

To undo the transaction with ID 5:

yum history undo 5

To redo the transaction with ID 8:

yum history redo 8

To list transactions where a particular package was installed:

yum history list | grep <package_name>

To know about how to remove Directory in linux, click here.