Product SiteDocumentation Site

6.2.6. Working with Transaction History

The dnf history command allows users to review information about a timeline of DNF transactions, the dates and times on when they occurred, the number of packages affected, whether transactions succeeded or were aborted, and if the RPM database was changed between transactions. Additionally, this command can be used to undo or redo certain transactions.

Listing Transactions

To display a list of all transactions, as root, either run dnf history with no additional arguments, or enter the following command:
dnf history list
To display only transactions in a given range, use the command in the following form:
dnf history list start_id..end_id
You can also list only transactions regarding a particular package or packages. To do so, use the command with a package name or a glob expression:
dnf history list glob_expression
For example, the list of first five transactions may look as follows:
~]# dnf history list 1..4
Using metadata from Thu Apr 16 13:41:45 2015 (5:47:31 hours old)
ID     | Login user               | Date a | Action | Altere
-------------------------------------------------------------------------------
     4 | root <root>              | 2015-04-16 18:35 | Erase          |    1
     3 | root <root>              | 2015-04-16 18:34 | Install        |    1
     2 | root <root>              | 2015-04-16 17:53 | Install        |    1
     1 | System <unset>           | 2015-04-16 14:14 | Install        |  668 E
The dnf history list command produces tabular output with each row consisting of the following columns:
Table 6.1. Possible values of the Action(s) field
Action Abbreviation Description
Downgrade D At least one package has been downgraded to an older version.
Erase E At least one package has been removed.
Install I At least one new package has been installed.
Obsoleting O At least one package has been marked as obsolete.
Reinstall R At least one package has been reinstalled.
Update U At least one package has been updated to a newer version.

Reverting and Repeating Transactions

Apart from reviewing the transaction history, the dnf history command provides means to revert or repeat a selected transaction. To revert a transaction, type the following at a shell prompt as root:
dnf history undo id
To repeat a particular transaction, as root, run the following command:
dnf history redo id
Both commands also accept the last keyword to undo or repeat the latest transaction.
Note that both dnf history undo and dnf history redo commands merely revert or repeat the steps that were performed during a transaction, and will fail if the required packages are not available. For example, if the transaction installed a new package, the dnf history undo command will uninstall it and also attempt to downgrade all updated packages to their previous version, but the command will fail if the required packages are not available.