This brief guide describes how to list installed packages sorted by installation date from command line in Linux and Unix-like operating systems. This can be helpful if you want to know how many or what packages you have installed on a certain date or time in your Linux box.
List Installed Packages Sorted By Installation Date In Linux
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:
[...] 2018-05-24 12:54:10 filesystem 2018-05-24 13:29:57 linux 2018-05-25 16:24:49 btfs 2018-05-25 16:24:49 libtorrent-rasterbar 2018-05-31 17:13:05 cheese 2018-05-31 17:13:05 clutter-gst 2018-05-31 17:39:12 gsl 2018-05-31 17:39:12 guvcview 2018-06-11 19:34:34 chromium 2018-06-11 19:41:24 firefox 2018-06-12 14:34:08 libappindicator-gtk2 2018-06-12 14:34:08 libdbusmenu-glib 2018-06-12 14:34:08 libdbusmenu-gtk2 2018-06-12 14:34:08 libindicator-gtk2 2018-06-12 14:37:52 ao 2018-06-16 13:20:31 exo 2018-06-16 13:20:31 libxfce4ui 2018-06-16 13:20:31 libxfce4util 2018-06-16 13:20:31 perl-uri 2018-06-16 13:20:31 xfconf 2018-06-16 13:20:32 thunar
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 it's 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-18.168.6.1-49.el7.noarch 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-17.168.5.3-49.el7.noarch Mon 22 May 2017 03:13:15 PM IST iwl5000-firmware-8.83.5.1_1-49.el7.noarch 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.
You know now what packages are installed and when you've installed them on your Linux system. Hope this helps.
Resources:
Thanks for stopping by!
Help us to help you:
- Subscribe to our Email Newsletter : Sign Up Now
- Support OSTechNix : Donate Via PayPal
- Download free E-Books and Videos : OSTechNix on TradePub
- Connect with us: Reddit | Facebook | Twitter | LinkedIn | RSS feeds
Have a Good day!!
3 comments
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
Thanks. Yes, you’re right. I updated the guide.
Thanks a lot…