This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Sunday, November 5, 2017

Single command to list the software packages (RPMs) by install date in Linux Server

Occasionally one needs to get a list of all software packages (rpm's) installed on a RHEL host, sorted by their install date. While there are many ways to do this

# rpm -qa --last



Linvirtshell.com












or

 copy and paste the following scriptlet into a shell command line:

#rpm -qa --queryformat="%{INSTALLTIME} %{NAME}\n" | sort -n | while read rpm_line; do rpm_date=$( date -d @$(echo $rpm_line | awk '{print $1}')); rpm=$( echo $rpm_line | awk '{print $2}'); printf '%-50s %s\n' "$rpm" "$rpm_date"; done

Linvirtshell.com
  
Hope it helps