yum history

How to Use Yum History to Find Installed or Removed Packages

Yum (Yellowdog Updater, Modified) is the default package manager for RHEL/Fedora/CentOS Linux systems. It allows you to install, update, modify and remove packages in your Linux system. It also allows you to setup automatic updates and find package dependencies in Linux. Sometimes you may need to find installed or removed packages in RHEL/CentOS/Fedora systems. You can use Yum history for this purpose since it keeps track of all transactions you have made using Yum package manager. In this article, we will learn how to use Yum history to find installed or removed packages in RHEL/CentOS/Fedora Linux.


How to Use Yum History to Find Installed or Removed Packages

Here is how to use Yum history to view past transactions.

View Full History

If you want to view the entire yum history use the following command to view transaction id, login user, date & time, action, etc. of each transaction done using yum command.

$ yum history
get package installed & removed in yum

Get Installed & Removed Packages

As you can see above the column Action mentions whether the transaction was done to install or erase a package. So you can call grep command on the about output and search for ‘Install’ or ‘Erase’ keywords. Here is an example to get all transactions where package was installed.

$ yum history | grep "Install"

Here is the command to get all transactions where package was removed.

$ yum history | grep "Erase"

Get Package Info

Yum history also supports many sub commands as optional arguments (info, list, summary) to easily get information about specific packages on your system. In addition to these arguments, you need to provide the transaction ID or package name to identify the desired package whose information you need. Here is another command to view full transaction history in yum.

# yum history list all

If you want to get details of package httpd (apache web server), you can do so using the following command.

# yum history info httpd

The above command will give you a detailed information about your package. If you only want a summary of information, use the following command instead.

# yum history summary httpd

If you only want the records related to installation, you can pass the output of above command to grep to search for keyword ‘Install’.

# yum history summary httpd | grep 'Install'

If you only want the records related to package removal, you can pass the output of above command to grep to search for keyword ‘Erase’.

# yum history summary httpd | grep 'Erase'

If you only want information about a specific transaction, then you can specify the transaction ID at the end of the command, instead of mentioning the package name. Here is an example to get information about transaction with ID=15.

# yum history info 15

Find Transaction Info Using Yum History

You can also use package-list or package-info sub commands as arguments to get more information about a package.

Here is the command to get package information about httpd server.

# yum history package-list httpd
OR
# yum history package-info httpd

If you want information about multiple packages just mention them one after the other in a space separated format.

# yum history package-list httpd epel-release
OR
# yum history packages-list httpd epel-release

Use Yum History to Rollback Packages

You can also use Yum history to undo/redo/rollback transactions using the undo/redo/rollback sub commands. You can specify the actual transaction id with these sub commands, or use last keyword or last-offset (e.g. last-5). Here is an example to undo, redo, rollback transaction 15.

# yum history undo 15    
# yum history redo 15    
# yum history rollback 15

Redo sub command also supports couple of additional sub commands force-reinstall and force-remove to reinstall and uninstall packages respectively, as done in the specified transaction.

Reset Yum History

If you want to reset your yum history file and start afresh, use the following command instead.

# yum history new

In this article, we have learnt how to use yum history to get package info about installed and removed packages, we have also learnt how to get information about specific packages.

Also read:

What To Do After Installing Ubuntu
How to Fix No Route to Host SSH Error in Linux
How to Find Django Install Location
Xargs Command to Kill Process
How to Enable Full Disk Encryption in Ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *