Eclean

eclean is a tool for cleaning Portage source files and binary packages.

Installation
Install :

Usage
By default, source files are in, while binary packages are in ; this can be changed by altering the  and the   variables respectively in. Both locations can grow quite big if not periodically cleaned.

You can clean the source files directory with the following command:

For the directory with the binary packages you should use the following command instead:

By default, source files and binary packages corresponding to any ebuild in the current Portage tree will not be deleted. This way, the user can easily downgrade a package or install a previously removed package, provided that it is still in the current Portage tree.

Let's make an example. Suppose packages  and   are both in the Portage tree. You update from  to , and then you run  : source files for both versions will be kept, so if you have any problem with   you can easily re-install   without re-downloading anything.

The other possible case is installing a previously removed package. Suppose you have package  (any version) in the Portage tree. You (inadvertently) remove it, and then you run : again, source files for   will be kept, so you can re-install it without re-downloading anything.

The same examples also apply for binary packages.

If you want to save more disk space you can add the  option: every source file or binary package that does not correspond to some currently installed package version will be deleted. Please notice that this way you won't be protected in case you need to downgrade a package or re-install a previously removed package.

As an alternative, you can use both the  and the   options: every source file or binary package that does not correspond to some currently installed package (version does not matter) will be deleted. You still won't be protected in case you need to re-install a previously removed package, but you will be protected if you need to downgrade a package.

For more details read the eclean(1) man page: