Cleaning up deinstalled packages on Debian (and Ubuntu)
Disclaimer: this is for advanced users, use at your own risk.
If you run Debian on the same system for a while, packages get removed automatically and they never get purged. This means that config files and other useless cruft gets left over after many upgrades. I searched the web for an easy one-liner but didn't find one, so I hope this helps someone
See how many packages are in the 'deinstalled' state with this command: