Find all user-installed packages

Solution 1:

Look at these files,

  1. '/var/log/installer/initial-status.gz' -- your primary installation
    • this file date would be your installation date (i think)
    • '/var/log/dpkg.log' update timeline (this is what you want)
    • '/var/log/apt/term.log' -- things apt updated on your system
    • '/var/cache/apt/archives/' will contain the deb packages downloaded for installation

Update: use the following two steps for exact list of new installs:

  1. execute: grep -w install /var/log/dpkg.log > full-list.log
  2. Look at lines beyond the /var/log/installer/initial-status.gz timestamp

Since you want to get a clean installation on another system with these packages, you could even copy the 'deb' files from the 'cache/apt/archives' path to that of the new installation and get them installed in one shot (without downloading them again).

Solution 2:

Just for grins, I put together a one-liner (here split for clarity) that figures out packages manually installed, excluding those installed initially and any packages automatically installed:

comm -13 \
  <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort) \
  <(comm -23 \
    <(dpkg-query -W -f='${Package}\n' | sed 1d | sort) \
    <(apt-mark showauto | sort) \
  )

This works both in bash and in zsh.

Solution 3:

Based on the information above, I wrote a short Python script to list packages that were manually installed. See this link.

Feel free to use it although I assume no responsibility for it. However, feedback and suggestions are always welcome.