How to display the history of installed, upgraded or deleted packages in Debian, Ubuntu or Linux Mint [dpkg]

This article explains how to display the history of recently installed, upgraded or deleted packages on Debian, Ubuntu or Linux Mint from the command line.
In order to be able to obtain a complete history list of package changes, including DEB packages that have been installed, upgraded, or removed, and to show the date when a specific operation was performed, in Debian or Ubuntu, dpkg can be read (low-level infrastructure for handling Debian Logs of installation and removal of software packages), the URL is /var/log/dpkg.log. you can use it grep This file can be parsed from the command line, and only packages that have been installed, upgraded, or removed have been displayed based on your needs. It applies to DEB packages installed in any way, whether using graphical tools (such as Synaptic, Gnome Software, Update Manager, or similar command-line tools apt, apt-get, aptitude Or dpkg. It does not apply to other software packages, such as Flatpak or Snap, or software installed from sources, etc.
Some alternative methods of displaying the history of the package manager on Debian, Ubuntu or Linux Mint will not display the complete log. For example, Synaptic Package Manager (File -> History) Can only display the history of installed, upgraded, or deleted packages that have performed these operations using Synaptic itself, but you will not see any packages installed, updated, or removed from the command line (use apt, apt-get, dpkg), Use a software updater or software application. Similarly, /var/log/apt/history.log The APT log file only lists the operations performed with the following commands apt/apt-get.

Display the history of recently installed packages, their version numbers and the date / time of installing them on Debian, Ubuntu or Linux Mint:

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

It looks like this:

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


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

On Debian, Ubuntu or Linux Mint, display the list of recently upgraded packages, the date / time of the upgrade, and the version of the old and new packages:

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

On Debian, Ubuntu, or Linux Mint, display the history of recently removed packages and the date / time of removal:

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


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

/var/log/dpkg.log Contains the history of package installation, update, and deletion for that month. For the last month, please read /var/log/dpkg.log.1 Log file. For example, to view the package installation history of the last month, use:

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

Do you want to go further in the history of dpkg? To use zgrep Instead grepAnd then read /var/log/dpkg.log.2.gz, /var/log/dpkg.log.3.gz, /var/log/dpkg.log.4.gz And so on, can be traced back to two months, three months and 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, 12 old logs are retained (thus 12 consecutive months), and gzip is used to compress the rotating file.gz). You can check the Debian / Ubuntu Logrotate configuration of dpkg with the following command: cat /etc/logrotate.d/dpkg. From the same series:

  • How to find a package that provides files on Ubuntu, Debian or Linux Mint (installed or not)
  • How to prevent packages from being updated in Ubuntu, Debian or Linux Mint [APT]
  • How to search for available packages from the command line in Debian, Ubuntu or Linux Mint [APT]
  • How to list all packages in the repository on Ubuntu, Debian or Linux Mint [APT]