Updated: 22 October 2026 · Applies to: dnf 4.20 on AlmaLinux 10.2 and dnf 4.14 on AlmaLinux 9.8 (the yum command runs dnf; the same on Rocky Linux and RHEL 9 and 10), dnf5 5.4 on Fedora 44, tested
To check which version of a package is installed, run rpm -q rsync or dnf list --installed rsync (yum works the same, because on AlmaLinux, Rocky Linux and RHEL 8 to 10 it is dnf). To see when that version arrived and which version it replaced, run dnf history list rsync and then dnf history info ID. dnf history undo ID reverses one transaction, and dnf history rollback ID returns the system to the state right after transaction ID.
rpm -q rsync # installed version dnf list --installed rsync # installed version and the repository it came from dnf list --showduplicates rsync # every version the repositories offer dnf history list rsync # transactions that touched rsync dnf history info 5 # what transaction 5 changed, with versions dnf history undo 5 # reverse transaction 5 dnf history rollback 3 # undo everything done after transaction 3
The output below is a lab example from an AlmaLinux 10.2 test container. We installed tree (transaction 3), installed an older rsync 3.4.1 (transaction 4) and upgraded it to 3.5.0 (transaction 5). AlmaLinux 9.8 gave the same results with its own versions. Run the commands that change packages as root or with sudo.
1. Check the installed version of a package
rpm -q rsync
Output:
rsync-3.5.0-3.el10_2.x86_64
dnf list --showduplicates rsync
Output:
Installed Packages rsync.x86_64 3.5.0-3.el10_2 @baseos Available Packages rsync.x86_64 3.4.1-6.el10_2 baseos rsync.x86_64 3.4.4-1.el10_2 baseos rsync.x86_64 3.5.0-3.el10_2 baseos
The version is the part after the name: 3.5.0, release 3.el10_2. dnf info --installed rsync shows it field by field, and rpm -q --last rsync adds the date and time it was installed. To list all installed packages, see RHEL and Fedora: List Installed Packages and Yum Repositories; to install or lock one of the other versions, see How to Install, Downgrade or Lock a Specific Package Version with dnf.
2. Find the transactions that changed a package
dnf history list rsync
Output:
ID | Command line | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
5 | -y -q upgrade rsync | 2026-10-12 13:10 | Upgrade | 1
4 | -y -q --setopt=install_w | 2026-10-12 13:10 | Install | 1
dnf history (or yum history) without a package name lists every transaction, newest first; --reverse puts the oldest first. On a new server the first entries come from the installation itself. The columns and the markers such as EE are explained in yum Logs and dnf Logs: File Locations and dnf history Output, which also covers the plain text logs.
3. See which versions a transaction changed
dnf history info 5
Output:
Transaction ID : 5
Begin time : Mon Oct 12 13:10:26 2026
...
User : Super User <root>
Return-Code : Success
Releasever : 10
Command Line : -y -q upgrade rsync
...
Packages Altered:
Upgrade rsync-3.5.0-3.el10_2.x86_64 @baseos
Upgraded rsync-3.4.1-6.el10_2.x86_64 @@System
(Output shortened.) Upgrade is the new version and Upgraded the version it replaced, so this answers "what did we run before the update?". dnf history info last shows the newest transaction, and last-1 the one before it.
4. Undo a transaction
undo does the opposite of every action in one transaction: it removes what was installed, reinstalls what was removed and downgrades what was upgraded. Add --assumeno first to see the plan without changing anything:
sudo dnf history undo 5
Output:
... Downgrading: rsync x86_64 3.4.1-6.el10_2 baseos 413 k Transaction Summary ================================================================================ Downgrade 1 Package ... Complete!
rpm -q rsync
Output:
rsync-3.4.1-6.el10_2.x86_64
Undoing an upgrade needs the old version in an enabled repository. When we hid the repositories, dnf refused:
dnf history undo 5 --disablerepo='*' --assumeno
Output:
Error: The following problems occurred while running a transaction: Cannot find rpm nevra "rsync-3.4.1-6.el10_2.x86_64".
Older builds are not kept in the repositories for ever, so undo soon after a bad update. dnf history redo 5 repeats a transaction; in our test it upgraded rsync to 3.5.0 again.
5. Roll back to an earlier point
rollback undoes every transaction after the one you name. Our history at this point: 6 undo, 7 redo, 8 removed tree, 9 reinstalled tree. Rolling back to transaction 3 (when only tree had been added) planned this:
dnf history rollback 3 --assumeno
Output:
... Removing: rsync x86_64 3.5.0-3.el10_2 @baseos 874 k ... Operation aborted.
tree stayed, because it was installed at transaction 3, and rsync went, because it came later. Before you roll back many transactions:
- Read the plan line by line, especially for kernel, glibc, systemd, OpenSSL or the SSH server.
- Package rollback does not restore configuration changes or data, such as a database upgraded by a newer server version.
- Take a backup or snapshot first. If a change cuts your SSH access on a Ucartz VPS, the VNC console still works: How to Access Your VPS via VNC in Virtualizor.
If an update was interrupted rather than wrong, see How to Recover an Interrupted dnf or apt Package Transaction.
6. Which packages did I install myself?
dnf history userinstalled
Output:
Packages installed by user almalinux-release-10.2-21.el10.x86_64 bash-5.2.26-6.el10.x86_64 ... tree-2.1.0-8.el10.x86_64
It lists packages installed on purpose (including the base packages chosen at installation), not those pulled in as dependencies. dnf repoquery --userinstalled gives the same list and also works with dnf5.
Fedora (dnf5): what is different
On Fedora, dnf and yum run dnf5 (on Fedora 44 both are links to /usr/bin/dnf5). The history commands are similar, with these differences:
- A package name is not accepted after
list:dnf history list rsyncfails withInvalid transaction ID range "rsync". Usednf history list --contains-pkgs=rsync. dnf history infoprints a table withUpgradeandReplacedlines, plus the reason (for exampleUser) and the repository.dnf history userinstalleddoes not exist ("Unknown argument"); usednf repoquery --userinstalled.undo,redo,rollbackandinfo lastwork as on dnf 4; rollback also removed a dependency (xxhash-libs) that rsync had pulled in.
Both versions can save a transaction to a file with dnf history store ID (dnf5 marks it experimental) to repeat it on another server. On dnf 4 the file is replayed with dnf history replay FILE, according to the DNF command reference.
Ubuntu and Debian
apt has no history or undo command. Its record is /var/log/apt/history.log, with each command and the package versions it changed; apt list --installed nginx shows the installed version.
Official documentation: DNF command reference (History command).