apt-get install aptitude
Aptitude keeps a track of packages taken to fulfill dependencies to other packages, so not installed explicitely, which allows to remove packages when the package that needed it is removed.
To detect orphaned packages, use the
When used without parameters, it only lists the libraries on which no package depends.
There are lots of locales supported by Ubuntu packages, which may take up quite a lot of disk space. The
localepurge tool permits to wipe the unused locales.
If you uninstall stuff with
apt-get remove, sometimes Ubuntu does not removes config files and they also take up space. Now, you can just use
apt-get purge. If you haven’t used it for every remove, this command lists all the packages which are removed but still have config files on your system:
dpkg --list | grep '^rc '
Remove them using:
deborphan --find-config | xargs dpkg --purge
There are also many transitional dummy packages that exist only for the upgrade to happen smoothly. To detect them:
$ dpkg -l|grep dummy
$ dpkg -l|grep transitional
$ dpkg -l|grep obsolete
Use apt-get to remove the ones that you don’t need, but pay attention to their dependencies. You might end up deleting your entire Linux image.
Your system is now lean and smooth.
reboot it when you are done.