I needed to determine which packages were recently installed on a
CentOS
7 system where
yum is used to install packages. The command
rpm -qa --last
will list all packages that have been installed
in chronological order with the most recently installed packages listed
first, since the --last
option orders the package listing by
install time such that the latest packages are at the top. E.g.:
# rpm -qa --last amarok-utils-2.8.0-19.el7.x86_64 Fri 12 Aug 2016 09:02:34 PM EDT amarok-libs-2.8.0-19.el7.x86_64 Fri 12 Aug 2016 09:02:34 PM EDT amarok-2.8.0-19.el7.x86_64 Fri 12 Aug 2016 09:02:31 PM EDT taglib-extras-1.0.1-8.el7.x86_64 Fri 12 Aug 2016 09:02:17 PM EDT mariadb-embedded-5.5.50-1.el7_2.x86_64 Fri 12 Aug 2016 09:02:17 PM EDT qjson-0.8.1-4.el7.x86_64 Fri 12 Aug 2016 09:02:15 PM EDT kdelibs-webkit-4.14.8-1.el7.x86_64 Fri 12 Aug 2016 09:02:14 PM EDT qtscriptbindings-0.2.0-5.el7.x86_64 Fri 12 Aug 2016 09:02:13 PM EDT qtwebkit-2.3.4-6.el7.x86_64 Fri 12 Aug 2016 09:01:57 PM EDT alpine-2.20-2.el7.x86_64 Mon 08 Aug 2016 10:13:54 PM EDT fuse-sshfs-2.5-1.el7.x86_64 Mon 08 Aug 2016 09:28:26 PM EDT gpg-pubkey-352c64e5-52ae6884 Mon 08 Aug 2016 09:27:13 PM EDT epel-release-7-6.noarch Mon 08 Aug 2016 09:12:51 PM EDT lynx-2.8.8-0.3.dev15.el7.x86_64 Fri 05 Aug 2016 10:28:17 PM EDT telnet-0.17-59.el7.x86_64 Sat 30 Jul 2016 04:34:17 PM EDT thunderbird-45.2-1.el7.centos.x86_64 Sat 30 Jul 2016 04:10:55 PM EDT mutt-1.5.21-26.el7.x86_64 Sat 30 Jul 2016 03:50:58 PM EDT <text snipped> gnu-free-fonts-common-20120503-8.el7.noarch Fri 15 Jul 2016 03:10:39 PM EDT dejavu-fonts-common-2.33-6.el7.noarch Fri 15 Jul 2016 03:10:39 PM EDT libgcc-4.8.5-4.el7.x86_64 Fri 15 Jul 2016 03:10:38 PM EDT fontpackages-filesystem-1.44-8.el7.noarch Fri 15 Jul 2016 03:10:38 PM EDT control-center-filesystem-3.14.5-8.el7.x86_64 Fri 15 Jul 2016 03:10:38 PM EDT #
Alternatively, I could obtain a list of package installation dates ordered from the oldest packages installed to the most recently installed packages with the oldest ones being listed first using the command below:
# rpm -qa --qf '%{INSTALLTIME} %{INSTALLTIME:date} %{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -n 1468609838 Fri 15 Jul 2016 03:10:38 PM EDT control-center-filesystem-3.14.5-8.el7.x86_64 1468609838 Fri 15 Jul 2016 03:10:38 PM EDT fontpackages-filesystem-1.44-8.el7.noarch 1468609838 Fri 15 Jul 2016 03:10:38 PM EDT libgcc-4.8.5-4.el7.x86_64 1468609839 Fri 15 Jul 2016 03:10:39 PM EDT dejavu-fonts-common-2.33-6.el7.noarch 1468609839 Fri 15 Jul 2016 03:10:39 PM EDT gnu-free-fonts-common-20120503-8.el7.noarch <text snipped> 1469908255 Sat 30 Jul 2016 03:50:55 PM EDT urlview-0.9-15.20121210git6cfcad.el7.x86_64 1469908258 Sat 30 Jul 2016 03:50:58 PM EDT mutt-1.5.21-26.el7.x86_64 1469909455 Sat 30 Jul 2016 04:10:55 PM EDT thunderbird-45.2-1.el7.centos.x86_64 1469910857 Sat 30 Jul 2016 04:34:17 PM EDT telnet-0.17-59.el7.x86_64 1470450497 Fri 05 Aug 2016 10:28:17 PM EDT lynx-2.8.8-0.3.dev15.el7.x86_64 1470705171 Mon 08 Aug 2016 09:12:51 PM EDT epel-release-7-6.noarch 1470706033 Mon 08 Aug 2016 09:27:13 PM EDT gpg-pubkey-352c64e5-52ae6884.(none) 1470706106 Mon 08 Aug 2016 09:28:26 PM EDT fuse-sshfs-2.5-1.el7.x86_64 1470708834 Mon 08 Aug 2016 10:13:54 PM EDT alpine-2.20-2.el7.x86_64 1471050117 Fri 12 Aug 2016 09:01:57 PM EDT qtwebkit-2.3.4-6.el7.x86_64 1471050133 Fri 12 Aug 2016 09:02:13 PM EDT qtscriptbindings-0.2.0-5.el7.x86_64 1471050134 Fri 12 Aug 2016 09:02:14 PM EDT kdelibs-webkit-4.14.8-1.el7.x86_64 1471050135 Fri 12 Aug 2016 09:02:15 PM EDT qjson-0.8.1-4.el7.x86_64 1471050137 Fri 12 Aug 2016 09:02:17 PM EDT mariadb-embedded-5.5.50-1.el7_2.x86_64 1471050137 Fri 12 Aug 2016 09:02:17 PM EDT taglib-extras-1.0.1-8.el7.x86_64 1471050151 Fri 12 Aug 2016 09:02:31 PM EDT amarok-2.8.0-19.el7.x86_64 1471050154 Fri 12 Aug 2016 09:02:34 PM EDT amarok-libs-2.8.0-19.el7.x86_64 1471050154 Fri 12 Aug 2016 09:02:34 PM EDT amarok-utils-2.8.0-19.el7.x86_64 #
If I only wanted to see the package names without the version information,
but ordered from the first installed to the last installed, I could use the
command below piping the output of the
sort command to the
cut command and using
a space character for the delimiter between fields, i.e., -d" "
and displaying only field number two with -f2
.
# rpm -qa --qf '%{INSTALLTIME} %{NAME}\n' | sort -n | cut -d" " -f2 control-center-filesystem fontpackages-filesystem libgcc dejavu-fonts-common gnu-free-fonts-common <text snipped> urlview mutt thunderbird telnet lynx epel-release gpg-pubkey fuse-sshfs alpine qtwebkit qtscriptbindings kdelibs-webkit qjson mariadb-embedded taglib-extras amarok amarok-libs amarok-utils #
The tags you can use for the rpm query are shown below:
# rpm --querytags ARCH ARCHIVESIZE BASENAMES BUGURL BUILDARCHS BUILDHOST BUILDTIME C CHANGELOGNAME CHANGELOGTEXT CHANGELOGTIME CLASSDICT COLLECTIONS CONFLICTFLAGS CONFLICTNAME CONFLICTNEVRS CONFLICTS CONFLICTVERSION COOKIE DBINSTANCE DEPENDSDICT DESCRIPTION DIRINDEXES DIRNAMES DISTRIBUTION DISTTAG DISTURL DSAHEADER E EPOCH EPOCHNUM EVR EXCLUDEARCH EXCLUDEOS EXCLUSIVEARCH EXCLUSIVEOS FILECAPS FILECLASS FILECOLORS FILECONTEXTS FILEDEPENDSN FILEDEPENDSX FILEDEVICES FILEDIGESTALGO FILEDIGESTS FILEFLAGS FILEGROUPNAME FILEINODES FILELANGS FILELINKTOS FILEMD5S FILEMODES FILEMTIMES FILENAMES FILENLINKS FILEPROVIDE FILERDEVS FILEREQUIRE FILESIZES FILESTATES FILEUSERNAME FILEVERIFYFLAGS FSCONTEXTS GIF GROUP HDRID HEADERCOLOR HEADERI18NTABLE HEADERIMAGE HEADERIMMUTABLE HEADERREGIONS HEADERSIGNATURES ICON INSTALLCOLOR INSTALLTID INSTALLTIME INSTFILENAMES INSTPREFIXES LICENSE LONGARCHIVESIZE LONGFILESIZES LONGSIGSIZE LONGSIZE N NAME NEVR NEVRA NOPATCH NOSOURCE NVR NVRA O OBSOLETEFLAGS OBSOLETENAME OBSOLETENEVRS OBSOLETES OBSOLETEVERSION OLDFILENAMES OPTFLAGS ORDERFLAGS ORDERNAME ORDERVERSION ORIGBASENAMES ORIGDIRINDEXES ORIGDIRNAMES ORIGFILENAMES OS P PACKAGER PATCH PATCHESFLAGS PATCHESNAME PATCHESVERSION PAYLOADCOMPRESSOR PAYLOADFLAGS PAYLOADFORMAT PKGID PLATFORM POLICIES POLICYFLAGS POLICYNAMES POLICYTYPES POLICYTYPESINDEXES POSTIN POSTINFLAGS POSTINPROG POSTTRANS POSTTRANSFLAGS POSTTRANSPROG POSTUN POSTUNFLAGS POSTUNPROG PREFIXES PREIN PREINFLAGS PREINPROG PRETRANS PRETRANSFLAGS PRETRANSPROG PREUN PREUNFLAGS PREUNPROG PROVIDEFLAGS PROVIDENAME PROVIDENEVRS PROVIDES PROVIDEVERSION PUBKEYS R RECONTEXTS RELEASE REMOVETID REQUIREFLAGS REQUIRENAME REQUIRENEVRS REQUIRES REQUIREVERSION RPMVERSION RSAHEADER SHA1HEADER SIGGPG SIGMD5 SIGPGP SIGSIZE SIZE SOURCE SOURCEPACKAGE SOURCEPKGID SOURCERPM SUMMARY TRIGGERCONDS TRIGGERFLAGS TRIGGERINDEX TRIGGERNAME TRIGGERSCRIPTFLAGS TRIGGERSCRIPTPROG TRIGGERSCRIPTS TRIGGERTYPE TRIGGERVERSION URL V VCS VENDOR VERBOSE VERIFYSCRIPT VERIFYSCRIPTFLAGS VERIFYSCRIPTPROG VERSION XPM #
References: