If you want to clean up your Ubuntu or Debian machine and delete unnecessary (orphaned) deb packages you can use the utility deborphan. It finds packages that have no packages depending on them. First install deborphan:
aptitude install deborphan
Then start of with a dry run just to make sure that you are not removing any packages you still need
deborphan --guess-all
To delete unnecessary data packages use the command:
sudo deborphan --guess-data | xargs sudo aptitude -y purge
To delete all unnecessary packages use the command:
sudo deborphan --guess-all | xargs sudo aptitude -y purge
To get rid of downloaded deb packages use:
aptitude autoclean