Skip to main content
2 of 6
Add markers.
Stephen Kitt
  • 481.5k
  • 60
  • 1.2k
  • 1.4k

The list of installed packages is in /var/lib/dpkg/status; that is the canonical reference. Installed packages are signalled in that file by their “install ok installed” status.

If you only want to track a list of installed packages, you can run

dpkg --get-selections

periodically and store its output in a file tracked with git.

As pointed out by Martin Konrad, you should also track the manually-installed markers, and I’d add the holds too:

apt-mark showmanual
apt-mark showhold

You could add all the above to a dpkg hook, to track all changes to your system; I’ll add a working example to this answer later.

Stephen Kitt
  • 481.5k
  • 60
  • 1.2k
  • 1.4k