How To Show A History Of Installed, Upgraded Or Removed Packages In Debian, Ubuntu or Linux Mint [dpkg]

This article explains how to show a history of recently installed, upgraded or removed packages, on Debian, Ubuntu or Linux Mint, from the command line.

To be able to get a complete history list of package changes, including installed, upgraded or removed DEB packages, and show the date on which a particular action was performed, in Debian or Ubuntu, one can read the dpkg (the low-level infrastructure for handling the installation and removal of Debian software packages) log available at /var/log/dpkg.log. You can use grep to parse this file from the command line and only display installed, upgraded or removed packages, depending on what you need.

This works for DEB packages installed in any way, be it using a graphical tool such as Synaptic, Gnome Software, Update Manager, or a command line tool like apt, apt-get, aptitude or dpkg. It does not work for other packages, like Flatpak or Snap, or for software installed from source, and so on.

Some alternative ways of showing the package manager history on Debian, Ubuntu or Linux Mint, do not display a complete log. For example, Synaptic Package Manager (File -> History) can only show a history of installed, upgraded or removed software packages for which Synaptic itself was used to perform those actions, but you won't see any packages installed, updated or removed from the command line (using apt, apt-get, dpkg), using the Software Updater, or the Software application. Similarly, the /var/log/apt/history.log APT log file only lists actions performed using apt/apt-get.

Show a history of recently installed packages, their version number, and the date / time they were installed on Debian, Ubuntu or Linux Mint:

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

This is how it looks:

$ grep "install " /var/log/dpkg.log
2019-01-08 13:22:15 install automathemely:all <none> 1.3
2019-01-08 13:22:29 install python3-astral:all <none> 1.6.1-1
2019-01-08 13:22:29 install python3-tzlocal:all <none> 1.5.1-1
2019-01-08 13:22:29 install python3-schedule:all <none> 0.3.2-1


2019-01-09 17:19:49 install libwebkit2-sharp-4.0-cil:amd64 <none> 2.10.9+git20160917-1.1
2019-01-09 17:19:49 install sparkleshare:all <none> 3.28-1
2019-01-15 15:58:20 install ffsend:amd64 <none> 0.1.2

Show a list of recently upgraded packages, the date / time they were upgraded, as well as the old and new package version, on Debian, Ubuntu or Linux Mint:

grep "upgrade " /var/log/dpkg.log

Sample output:

$ grep "upgrade " /var/log/dpkg.log
2019-01-07 11:14:10 upgrade tzdata:all 2018g-0ubuntu0.18.10 2018i-0ubuntu0.18.10
2019-01-07 11:35:14 upgrade davinci-resolve:amd64 15.2-2 15.2.2-1
2019-01-07 12:31:04 upgrade chromium-chromedriver:amd64 72.0.3626.17-0ubuntu1~ppa1~18.10.1 72.0.3626.28-0ubuntu1~ppa1~18.10.1
2019-01-07 12:31:04 upgrade chromium-browser-l10n:all 72.0.3626.17-0ubuntu1~ppa1~18.10.1 72.0.3626.28-0ubuntu1~ppa1~18.10.1
2019-01-07 12:31:08 upgrade chromium-browser:amd64 72.0.3626.17-0ubuntu1~ppa1~18.10.1 72.0.3626.28-0ubuntu1~ppa1~18.10.1
2019-01-07 12:31:12 upgrade chromium-codecs-ffmpeg-extra:amd64 72.0.3626.17-0ubuntu1~ppa1~18.10.1 72.0.3626.28-0ubuntu1~ppa1~18.10.1


2019-01-15 15:51:31 upgrade vlc-plugin-bittorrent:amd64 2.5-1~cosmic 2.6-1~cosmic
2019-01-15 17:30:44 upgrade virtualbox-6.0:amd64 6.0.0-127566~Ubuntu~bionic 6.0.2-128162~Ubuntu~bionic
2019-01-15 17:34:33 upgrade libarchive13:amd64 3.2.2-5 3.2.2-5ubuntu0.1
2019-01-16 12:32:43 upgrade oracle-java11-installer:amd64 11.0.1-2~linuxuprising1 11.0.2-1~linuxuprising0
2019-01-16 12:42:20 upgrade nvidiux:amd64 2.0.4 2.1
2019-01-16 13:41:05 upgrade plata-theme:all 0.4.1-0ubuntu1~cosmic1 0.5.4-0ubuntu1~cosmic1

Show a history of recently removed packages and the date / time they were removed, on Debian, Ubuntu or Linux Mint:

grep "remove " /var/log/dpkg.log


$ grep "remove " /var/log/dpkg.log
2019-01-10 12:30:55 remove automathemely:all 1.3 <none>
2019-01-11 13:16:38 remove persepolis:all <none>
2019-01-11 13:38:52 remove python3-astral:all 1.6.1-1 <none>
2019-01-11 13:38:52 remove python3-psutil:amd64 5.4.6-1build1 <none>
2019-01-11 13:38:52 remove python3-pyxattr:amd64 0.6.0-2build3 <none>
2019-01-11 13:38:52 remove python3-schedule:all 0.3.2-1 <none>
2019-01-11 13:38:53 remove python3-tzlocal:all 1.5.1-1 <none>

/var/log/dpkg.log contains the package install, update and remove history for the current month. For the previous month, read the /var/log/dpkg.log.1 log file. For example to see the package installation history for the previous month, use:

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

Want to go back even more in the dpkg history? Use zgrep instead of grep, and read /var/log/dpkg.log.2.gz, /var/log/dpkg.log.3.gz, /var/log/dpkg.log.4.gz and so on, which go back two, three and respectively four months.


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

This is because by default on Debian, Ubuntu and Linux Mint, the dpkg log is set to rotate once a month, keeping 12 old logs (so for 12 months), and compress rotated files by using gzip (.gz). You can check the Debian/Ubuntu Logrotate configuration for dpkg by using cat /etc/logrotate.d/dpkg.

From the same series: