How To List Installed Packages Sorted By Installation Date In Linux

List Installed Packages Sorted By Installation Date

This brief guide describes how to list installed packages sorted by installation date from command line in Unix-like operating systems. This can be helpful if you want to know what or how many packages you have installed on a certain date or time in your Linux box.

List Installed Packages Sorted By Installation Date

On Arch Linux and derivatives:

In Arch Linux and its derivatives like Antergos, and Manjaro Linux, you can list the installed packages sorted by installation date using command:

expac --timefmt='%Y-%m-%d %T' '%l\t%n'|sort -n

Sample output from my Arch Linux box:

2017-06-15 20:08:15 virtualbox-host-modules-arch
2017-06-15 20:08:17 xterm
2017-06-15 20:08:17 youtube-dl
2017-06-21 15:51:00 tilda
2017-06-24 13:29:21 newsbeuter
2017-06-24 13:29:21 stfl
2017-06-24 13:46:13 flashplugin
2017-06-27 16:23:49 cylon

The above command will list all installed packages sorted by the install date. You can also list the 10 last installed packages using command:

expac --timefmt='%Y-%m-%d %T' '%l\t%n' | sort | tail -n 10

On RPM based systems:

In RHEL, and its clones like CentOS, Scientific Linux, run the following command as root user to list the installed packages:

rpm -qa --last

Sample output from my CentOS 7 system:

iwl105-firmware- Mon 22 May 2017 03:13:16 PM IST
libreport-filesystem-2.1.11-35.el7.centos.x86_64 Mon 22 May 2017 03:13:15 PM IST
iwl6000g2a-firmware- Mon 22 May 2017 03:13:15 PM IST
iwl5000-firmware- Mon 22 May 2017 03:13:15 PM IST
epel-release-7-9.noarch Mon 22 May 2017 03:13:10 PM IST
libproxy-0.4.11-10.el7.x86_64 Mon 22 May 2017 03:13:09 PM IST
mariadb-libs-5.5.52-1.el7.x86_64 Mon 22 May 2017 03:13:08 PM IST
e2fsprogs-1.42.9-9.el7.x86_64 Mon 22 May 2017 03:13:07 PM IST
btrfs-progs-4.4.1-1.el7.x86_64 Mon 22 May 2017 03:13:06 PM IST
libselinux-python-2.5-6.el7.x86_64 Mon 22 May 2017 03:13:03 PM IST
avahi-autoipd-0.6.31-17.el7.x86_64 Mon 22 May 2017 03:13:03 PM IST
sudo-1.8.6p7-21.el7_3.x86_64 Mon 22 May 2017 03:13:02 PM IST

Also, you can use this command to list the installed packages sorted by installation date or time:

rpm -qa --qf '%{INSTALLTIME} (%{INSTALLTIME:date}): %{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -n

To find out the installation date of a specific package, for example rsyslog, run:

rpm -q --last rsyslog

Sample output:

rsyslog-7.4.7-16.el7.x86_64 Mon 22 May 2017 03:13:00 PM IST

For more details, about rpm command, refer the man pages.

man rpm

On DEB based systems:

In Debian, Ubuntu and all APT based systems, you can list the installed packages sorted by install date/time using the following command:

grep " install " /var/log/dpkg.log

Sample output from my Ubuntu system:

2016-04-20 22:08:13 install base-passwd:amd64 <none> 3.5.39
2016-04-20 22:08:14 install base-files:amd64 <none> 9.4ubuntu4
2016-04-20 22:08:14 install libc6:amd64 <none> 2.23-0ubuntu3
2016-04-20 22:08:15 install perl-base:amd64 <none> 5.22.1-9
2016-04-20 22:08:15 install mawk:amd64 <none> 1.3.3-17ubuntu2
2016-04-20 22:08:15 install debconf:all <none> 1.5.58ubuntu1
2016-04-20 22:08:16 install adduser:all <none> 3.113+nmu3ubuntu4
2016-04-20 22:08:16 install bash:amd64 <none> 4.3-14ubuntu1
2016-04-20 22:08:16 install bsdutils:amd64 <none> 1:2.27.1-6ubuntu3
2016-04-20 22:08:16 install coreutils:amd64 <none> 8.25-2ubuntu2

If log rotation is enabled, you can view the previous install log using command:

grep " install " /var/log/dpkg.log.1

To view the archived logs, run:

zgrep " install " /var/log/dpkg.log.2.gz

Please note that if you have enabled log rotation, the logs will be deleted over time. So, there is no reliable method to list the installed packages by install date in your Debian or Ubuntu systems.

And, that’s all for now folks. You know now what was installed and when you installed them on your Linux system. Hope this helps. If you think our articles are useful, spend a moment to share them on your social, professional networks and support OSTechNix.

More good stuffs to come. Stay tuned!



Thanks for stopping by!

Help us to help you:

Have a Good day!!

You may also like...

  • Takz0r

    Thanks, didn’t know about expac.
    Except, in your example there is no sorting on date, but name instead. But ofcourse you could pipe it to sort;
    expac –timefmt=’%Y-%m-%d %T’ ‘%lt%n’|sort -n

    • SK

      Thanks. Yes, you’re right. I updated the guide.