Skip to content

Instantly share code, notes, and snippets.

@adkinss
Created August 12, 2016 15:28
Show Gist options
  • Save adkinss/6e996b9889582379d2008b82eb7d7b34 to your computer and use it in GitHub Desktop.
Save adkinss/6e996b9889582379d2008b82eb7d7b34 to your computer and use it in GitHub Desktop.
#!/bin/sh
# This script displays all the packages installed on a RedHat/CentOS system
# with additional information about installation time sorted by most recently
# installed packages first. This is useful when looking at what packages
# were recently updated.
#
# $ ./rpm_query.sh | head
# 1449154458 Thu 03 Dec 2015 02:54:18 PM UTC filesystem-3.2-20.el7.x86_64
# 1449154458 Thu 03 Dec 2015 02:54:18 PM UTC libgcc-4.8.5-4.el7.x86_64
# 1449154458 Thu 03 Dec 2015 02:54:18 PM UTC redhat-release-server-7.2-9.el7.x86_64
# 1449154458 Thu 03 Dec 2015 02:54:18 PM UTC setup-2.8.71-6.el7.noarch
# 1449154459 Thu 03 Dec 2015 02:54:19 PM UTC bind-license-9.9.4-29.el7.noarch
# 1449154459 Thu 03 Dec 2015 02:54:19 PM UTC langtable-0.0.31-3.el7.noarch
# 1449154460 Thu 03 Dec 2015 02:54:20 PM UTC basesystem-10.0-7.el7.noarch
# 1449154460 Thu 03 Dec 2015 02:54:20 PM UTC emacs-filesystem-24.3-18.el7.noarch
# 1449154460 Thu 03 Dec 2015 02:54:20 PM UTC langtable-data-0.0.31-3.el7.noarch
# 1449154460 Thu 03 Dec 2015 02:54:20 PM UTC tzdata-2015g-1.el7.noarch
rpm -qa --queryformat '%{INSTALLTIME} %{INSTALLTIME:date} %{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment