For a cyber security competition I participate in, I\'m given a Debian virtual machine with many packages installed and asked to clean extraneous or malicious packages.
You may also look at the file /var/lib/apt/extended_states.
cat /var/lib/apt/extended_states | grep -B2 'Auto-Installed: 0'
This is useful if you want to know what was installed on an old partition.