How to find out when Debian or Ubuntu package installed or updated

How do I find and list installed Debian or Ubuntu Linux packages date? How can I see when packages got updated on my systems?

Debian or Ubuntu Linux log package status changes and actions to a file. The default is /var/log/dpkg.log file. This file has log message in the following format:

ADVERTISEMENTS

Log messages are of the form ‘YYYY-MM-DD HH:MM:SS status state pkg installed-version’ for status change updates; ‘YYYY-MM-DD HH:MM:SS action pkg installed-version available-version’ for actions where action is one of install, upgrade, remove, purge; and ‘YYYY-MM-DD HH:MM:SS conffile filename decision’ for conffile changes where decision is either install or keep.

List packages by installation date

Simply type the following tail command to see the last packages info:
# tail -f /var/log/dpkg.log
$ sudo tail -f /var/log/dpkg.log

Sample outputs:

2019-11-13 23:11:39 purge linux-modules-extra-5.3.0-18-generic:amd64 5.3.0-18.19 
2019-11-13 23:11:39 status config-files linux-modules-extra-5.3.0-18-generic:amd64 5.3.0-18.19
2019-11-13 23:11:39 status not-installed linux-modules-extra-5.3.0-18-generic:amd64 
2019-11-13 23:11:39 purge linux-modules-5.3.0-18-generic:amd64 5.3.0-18.19 
2019-11-13 23:11:39 status config-files linux-modules-5.3.0-18-generic:amd64 5.3.0-18.19
2019-11-13 23:11:39 status not-installed linux-modules-5.3.0-18-generic:amd64 
2019-11-13 23:11:39 purge linux-image-5.3.0-18-generic:amd64 5.3.0-18.19+1 
2019-11-13 23:11:39 status config-files linux-image-5.3.0-18-generic:amd64 5.3.0-18.19+1
2019-11-13 23:11:39 status not-installed linux-image-5.3.0-18-generic:amd64 
2019-11-13 23:11:39 startup packages configure

To view all info, enter:
# less /var/log/dpkg.log
# more /var/log/dpkg.log

Fig.01: Ubuntu Linux List Package Install Upgrade Date and Time

Fig.01: Ubuntu Linux List Package Install Upgrade Date and Time

/var/log/dpkg.log may be rotated or compressed using logrotate tool. To view list of all files, enter:
# ls -l /var/log/dpkg.log*
Sample outputs:

-rw-r--r-- 1 root root  9252 Jan 14 13:27 /var/log/dpkg.log
-rw-r--r-- 1 root root 11658 Dec 16 03:53 /var/log/dpkg.log.1
-rw-r--r-- 1 root root  1563 Mar 22  2015 /var/log/dpkg.log.10.gz
-rw-r--r-- 1 root root 14218 Feb 17  2015 /var/log/dpkg.log.11.gz
-rw-r--r-- 1 root root   962 Nov 27 18:14 /var/log/dpkg.log.2.gz
-rw-r--r-- 1 root root  2008 Oct 30 14:09 /var/log/dpkg.log.3.gz
-rw-r--r-- 1 root root  2490 Sep 30 14:01 /var/log/dpkg.log.4.gz
-rw-r--r-- 1 root root  1875 Aug 17 05:09 /var/log/dpkg.log.5.gz
-rw-r--r-- 1 root root   847 Jul 22 12:31 /var/log/dpkg.log.6.gz
-rw-r--r-- 1 root root  1367 Jun 25  2015 /var/log/dpkg.log.7.gz
-rw-r--r-- 1 root root  1460 May 31  2015 /var/log/dpkg.log.8.gz
-rw-r--r-- 1 root root  5504 Apr 29  2015 /var/log/dpkg.log.9.gz

Use the zgrep or zmore command (zcommands) to search or view gzipd log files:
# zmore /var/log/dpkg.log.5.gz
# zless /var/log/dpkg.log.5.gz
# zgrep 'remove' /var/log/dpkg.log.5.gz

See package installation date and time

Run the following grep command:
# grep installed /var/log/dpkg.log
Sample outputs:

2019-11-01 19:42:58 status half-installed p7zip:amd64 16.02+dfsg-7
2019-11-01 19:42:58 status installed p7zip:amd64 16.02+dfsg-7
2019-11-01 19:43:00 status installed man-db:amd64 2.8.7-3
2019-11-01 19:44:12 status installed p7zip:amd64 16.02+dfsg-7
2019-11-01 19:44:12 status half-installed p7zip:amd64 16.02+dfsg-7
2019-11-01 19:44:12 status not-installed p7zip:amd64 
2019-11-01 19:44:14 status installed man-db:amd64 2.8.7-3
2019-11-01 19:44:59 status half-installed p7zip:amd64 16.02+dfsg-7
2019-11-01 19:44:59 status half-installed p7zip-full:amd64 16.02+dfsg-7
2019-11-01 19:45:00 status installed p7zip:amd64 16.02+dfsg-7
2019-11-01 19:45:00 status installed p7zip-full:amd64 16.02+dfsg-7
2019-11-01 19:45:01 status installed man-db:amd64 2.8.7-3
2019-11-02 00:32:46 status half-installed google-chrome-stable:amd64 78.0.3904.70-1
2019-11-02 00:32:50 status installed google-chrome-stable:amd64 78.0.3904.87-1
2019-11-02 00:32:50 status installed mime-support:all 3.63ubuntu1
2019-11-02 00:32:50 status installed gnome-menus:amd64 3.32.0-1ubuntu1
2019-11-02 00:32:52 status installed man-db:amd64 2.8.7-3
2019-11-02 00:32:52 status installed desktop-file-utils:amd64 0.24-1ubuntu1
2019-11-02 15:09:43 status half-installed imagemagick-6.q16:amd64 8:6.9.10.23+dfsg-2.1ubuntu3
2019-11-02 15:09:43 status half-installed imagemagick:amd64 8:6.9.10.23+dfsg-2.1ubuntu3
2019-11-02 15:09:43 status half-installed libmagickcore-6.q16-6-extra:amd64 8:6.9.10.23+dfsg-2.1ubuntu3
2019-11-02 15:09:43 status half-installed libnetpbm10:amd64 2:10.0-15.3build1
2019-11-02 15:09:43 status half-installed netpbm:amd64 2:10.0-15.3build1
2019-11-02 15:09:44 status installed libmagickcore-6.q16-6-extra:amd64 8:6.9.10.23+dfsg-2.1ubuntu3
2019-11-02 15:09:44 status installed libnetpbm10:amd64 2:10.0-15.3build1
2019-11-02 15:09:44 status installed netpbm:amd64 2:10.0-15.3build1
2019-11-02 15:09:44 status installed imagemagick-6.q16:amd64 8:6.9.10.23+dfsg-2.1ubuntu3
2019-11-02 15:09:44 status installed imagemagick:amd64 8:6.9.10.23+dfsg-2.1ubuntu3
2019-11-02 15:09:44 status installed mime-support:all 3.63ubuntu1
2019-11-02 15:09:44 status installed hicolor-icon-theme:all 0.17-2
2019-11-02 15:09:44 status installed gnome-menus:amd64 3.32.0-1ubuntu1
2019-11-02 15:09:44 status installed libc-bin:amd64 2.30-0ubuntu2
2019-11-02 15:09:47 status installed man-db:amd64 2.8.7-3
2019-11-02 15:09:47 status installed desktop-file-utils:amd64 0.24-1ubuntu1

To look into gzipd log file, enter:
# zgrep installed /var/log/dpkg.log.3.gz

List package upgrade date and time

# grep upgrade /var/log/dpkg.log
# grep upgrade /var/log/dpkg.log.1
#***[ Look into gzipd dpkg.log.2.gz file using zgrep ]***#
# zgrep upgrade /var/log/dpkg.log.2.gz

Show package removal (deleted) date and time

# grep remove /var/log/dpkg.log
# grep remove /var/log/dpkg.log.1
#***[ Look into gzipd dpkg.log.2.gz file using zgrep ]***#
# zgrep remove /var/log/dpkg.log.2.gz

Say hello to /var/log/apt/history.log file

The /var/log/apt/history.log file has same info too. To view, enter:
# tail -f /var/log/apt/history.log
# more /var/log/apt/history.log
# less /var/log/apt/history.log
# grep -A4 -B4 'yyyy-mm-dd' /var/log/apt/history.log
# grep -A4 '2016-01-14' /var/log/apt/history.log

Start-Date: 2016-01-14  13:18:16
Commandline: apt-get upgrade
Upgrade: isc-dhcp-common:amd64 (4.2.4-7ubuntu12.3, 4.2.4-7ubuntu12.4), isc-dhcp-client:amd64 (4.2.4-7ubuntu12.3, 4.2.4-7ubuntu12.4)
End-Date: 2016-01-14  13:18:24

grep -A4 '2019-11-05 11:18:36' /var/log/apt/history.log
Sample outputs:

Start-Date: 2019-11-05  11:18:36
Commandline: apt install lolcat
Requested-By: vivek (1000)
Install: lolcat:amd64 (42.0.99-1), ruby2.5:amd64 (2.5.5-4ubuntu2, automatic), rake:amd64 (12.3.1-3, automatic), ruby-net-telnet:amd64 (0.1.1-2, automatic), ruby-trollop:amd64 (2.0-2, automatic), ruby-minitest:amd64 (5.11.3-1, automatic), ruby-paint:amd64 (0.8.6-2, automatic), ruby-xmlrpc:amd64 (0.3.0-2, automatic), libruby2.5:amd64 (2.5.5-4ubuntu2, automatic), ruby:amd64 (1:2.5.1, automatic), ruby-power-assert:amd64 (1.1.1-1, automatic), rubygems-integration:amd64 (1.11, automatic), fonts-lato:amd64 (2.0-2, automatic), ruby-test-unit:amd64 (3.2.8-1, automatic), ruby-did-you-mean:amd64 (1.2.1-1, automatic)
End-Date: 2019-11-05  11:18:40

Say hello to dpkg-query

dpkg-query is a tool to show information about packages listed in the dpkg database under Debian or Ubuntu Linux. However, it does not show install or update date:
dpkg-query -l
Sample outputs:

| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                       Version                              Architecture Description
+++-==========================================-====================================-============-===============================================================================
ii  accountsservice                            0.6.55-0ubuntu10                     amd64        query and manipulate user account information
ii  acl                                        2.2.53-4                             amd64        access control list - utilities
ii  acpi-support                               0.143                                amd64        scripts for handling many ACPI events
ii  acpid                                      1:2.0.31-1ubuntu2                    amd64        Advanced Configuration and Power Interface event daemon
ii  adduser                                    3.118ubuntu1                         all          add and remove users and groups
ii  adwaita-icon-theme                         3.34.0-1ubuntu1                      all          default icon theme of GNOME (small subset)
ii  adwaita-icon-theme-full                    3.34.0-1ubuntu1                      all          default icon theme of GNOME
ii  aisleriot                                  1:3.22.9-1                           amd64        GNOME solitaire card game collection
ii  alsa-base                                  1.0.25+dfsg-0ubuntu5                 all          ALSA driver configuration files
ii  alsa-utils                                 1.1.9-0ubuntu1                       amd64        Utilities for configuring and using ALSA
ii  amd64-microcode                            3.20181128.1ubuntu2                  amd64        Processor microcode firmware for AMD CPUs
ii  anacron                                    2.3-29                               amd64        cron-like program that doesn't go by time
ii  ansible                                    2.8.3+dfsg-1                         all          Configuration management, deployment, and task execution system
rc  apache2                                    2.4.41-1ubuntu1                      amd64        Apache HTTP Server
ii  apg                                        2.2.3.dfsg.1-5                       amd64        Automated Password Generator - Standalone version
ii  app-install-data-partner                   19.04                                all          Application Installer (data files for partner applications/repositories)
ii  apparmor                                   2.13.3-5ubuntu1                      amd64        user-space parser utility for AppArmor
ii  apport                                     2.20.11-0ubuntu8.2                   all          automatically generate crash reports for debugging

See dpkg-query man page for more info here.

Conclusion

You learned how to find out when packages were installed or updated on a Debian or Ubuntu Linux using vaious command line options.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS

Comments on this entry are closed.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.