Home Linux Commands How To List Installed Packages Sorted By Installation Date In Linux

How To List Installed Packages Sorted By Installation Date In Linux

By sk
14,825 Views

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 while you want to get the rpm packages update history such as when a package is installed, how many packages are installed on your system on a specific date and time and what packages you have installed on a certain date or time in your Linux box.

List Installed Packages Sorted By Installation Date In Linux

There are different way to list the packages on a Linux system by the date they were last installed or updated.

1. List installed packages sorted by install date on Arch Linux and derivatives

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

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

Sample output from my Arch Linux box:

2020-12-15 13:02:09 iana-etc
2020-12-15 13:02:10 filesystem
2020-12-15 13:02:10 linux-api-headers
2020-12-15 13:02:12 tzdata
2020-12-15 13:02:14 glibc
2020-12-15 13:02:17 gcc-libs
2020-12-15 13:02:20 ncurses
2020-12-15 13:02:20 readline
2020-12-15 13:02:21 acl
2020-12-15 13:02:21 attr
[...]
List installed packages sorted by install date on Arch Linux

List installed packages sorted by install date on Arch Linux

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

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

If expac is not installed on your Arch Linux system, run the following command to install it:

$ sudo pacman -S expac

2. Get the RPM packages update history on RHEL, CentOS, Fedora

In Fedora, RHEL, and it's clones like CentOS, run the following command as root or sudo user to list the installed packages history:

# rpm -qa --last

Sample output from Fedora:

gpg-pubkey-9570ff31-5e3006fb Monday 19 October 2020 11:40:17 PM
rootfiles-8.1-28.fc33.noarch Monday 19 October 2020 11:37:48 PM
fedora-repos-modular-33-1.noarch Monday 19 October 2020 11:37:48 PM
tar-1.32-6.fc33.x86_64 Monday 19 October 2020 11:37:47 PM
syslinux-extlinux-6.04-0.16.fc33.x86_64 Monday 19 October 2020 11:37:47 PM
sudo-1.9.2-1.fc33.x86_64 Monday 19 October 2020 11:37:47 PM
rsync-3.2.3-1.fc33.x86_64 Monday 19 October 2020 11:37:47 PM
parted-3.3-5.fc33.x86_64 Monday 19 October 2020 11:37:47 PM
man-db-2.9.2-6.fc33.x86_64 Monday 19 October 2020 11:37:47 PM
hostname-3.23-3.fc33.x86_64 Monday 19 October 2020 11:37:47 PM
[...]
Get the RPM packages update history on RHEL, CentOS, Fedora

Get the RPM packages update history on RHEL, CentOS, Fedora

Sample output from CentOS:

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 rsync, run:

# rpm -q --last rsync

Sample output:

rsync-3.2.3-1.fc33.x86_64 Monday 19 October 2020 11:37:47 PM

3. View package update history on Debian, Ubuntu 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

Or,

$ grep install /var/log/dpkg.log

Or,

$ grep installed /var/log/dpkg.log

Sample output from Ubuntu:

[...]
2021-02-05 16:38:09 status installed python3-update-manager:all 1:20.04.10.5
2021-02-05 16:38:09 status installed update-manager-core:all 1:20.04.10.5
2021-02-05 16:38:15 status installed man-db:amd64 2.9.1-1
2021-02-05 16:38:16 status installed menu:amd64 2.1.47ubuntu4
2021-02-05 16:38:16 status installed desktop-file-utils:amd64 0.24-1ubuntu3
2021-02-05 16:38:17 status installed mime-support:all 3.64ubuntu1
2021-02-05 16:38:17 status installed gnome-menus:amd64 3.36.0-1ubuntu1
2021-02-05 16:38:19 status installed libglib2.0-0:amd64 2.64.6-1~ubuntu20.04.1
2021-02-05 16:38:19 status installed update-manager:all 1:20.04.10.5
2021-02-05 16:38:19 status installed gconf2:amd64 3.2.6-6ubuntu1
View package update history on Debian, Ubuntu

View package update history on Debian, Ubuntu

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.

These are a few methods to find the package update history in Linux. You know now what packages are installed and when you've installed them on your Linux system. Hope this helps.

Related read:

Resources:

You May Also Like

4 comments

Takz0r June 28, 2017 - 5:26 am

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

Reply
SK June 28, 2017 - 1:41 pm

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

Reply
saddam hossain November 27, 2018 - 10:53 am

Thanks a lot…

Reply
Jalal February 6, 2021 - 10:21 am

Hi,
Thank you so much for the great topic,

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More