It's just "apt-get autoremove" and it'll remove any packages that were not specifically installed (i.e. were pulled in as dependencies) and are not required by any currently installed packages.