Using
apt-mark:comm -23 <(apt-mark showmanual | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u)
Using
aptitude:comm -23 <(aptitude search '~i !~M' -F '%p' | sed "s/ *$//" | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u)
How does it work
- Get the list of manually installed packages. For aptitude, the additional
sedstrips out remaining whitespace at the end of the line. - Get the list of packages installed right after a fresh install.
- Compare the files, only output the lines in file 1 that are not present in file 2.
Other possibilities don't work as well:
- Using the
ubuntu-14.04-desktop-amd64.manifestfile (here for Ubuntu 14.04) instead of/var/log/installer/initial-status.gz. More packages are shown as manually installed even though they are not. - Using
apt-mark showautoinstead of/var/log/installer/initial-status.gz.apt-markfor example doesn't include the xserver-xorg package, while the other file does.
Both list more packages than the above solution.