CentOS / RHEL : How to find RPM installation date and time

You can use the following command to display the install date and time of all the packages installed on your system:

rpm -qa --last

For example :

# rpm -qa --last | more
aide-0.14-11.el6.x86_64                       Tue 22 Aug 2017 12:57:07 AM IST
tzdata-java-2017b-1.el6.noarch                Tue 22 Aug 2017 12:27:22 AM IST
trace-cmd-2.2.4-4.el6.x86_64                  Tue 22 Aug 2017 12:27:22 AM IST
ql2500-firmware-7.03.00-1.el6_5.noarch        Tue 22 Aug 2017 12:27:22 AM IST
hal-info-20090716-5.el6.noarch                Tue 22 Aug 2017 12:27:22 AM IST
zip-3.0-1.el6_7.1.x86_64                      Tue 22 Aug 2017 12:27:21 AM IST
........

You can grep for a specific rpm name and find out the time of installation only for that particular package. For example to find the installation time of all packages with string kernel in them (Returns the install date and time for all packages with kernel in their name, such as the kernel, kernel-utils, etc.):

# rpm -qa --last | grep kernel
dracut-kernel-004-409.el6_8.2.noarch          Tue 22 Aug 2017 12:26:53 AM IST
libreport-plugin-kerneloops-2.0.9-33.el6.x86_64 Tue 22 Aug 2017 12:26:23 AM IST
abrt-addon-kerneloops-2.0.8-43.el6.x86_64     Tue 22 Aug 2017 12:26:23 AM IST
kernel-2.6.32-504.el6.x86_64                  Fri 15 Aug 2014 10:00:46 PM IST
kernel-firmware-2.6.32-504.el6.noarch         Fri 15 Aug 2014 10:00:42 PM IST
kernel-headers-2.6.32-504.el6.x86_64          Fri 15 Aug 2014 09:58:41 PM IST

For information about a specific package, specify the package_name in the command:

# rpm -q --last [package_name]

For example, you can use this command to look at the Firefox package installation time :

# rpm -qa --last firefox
firefox-52.2.0-1.el6_9.x86_64                 Tue 22 Aug 2017 12:27:05 AM IST

Formatting the output

We can also format the output of the “rpm -qa –last” command as per our needs. For example you can list the installation time for Firefox RPM

# rpm -qa --queryformat '(%{installtime:date}) %{name}\n' firefox
(Tue 22 Aug 2017 12:27:05 AM IST) firefox

You can get a list of –queryformat Tags here.

Related Post