One of the routine end-of-year tasks you might want to perform is the removal of old packages that your system downloaded but may no longer need. You may have installed applications and later uninstalled them, but your package manager sometimes keeps those downloaded packages in case you need them later. Fortunately, with APT, it is easy to remove those unneeded packages.
To remove old APT packages, do the following:
- Login to your server
- Become root:
- Type the following command:
# apt-get clean
This will remove every downloaded package except any lock files in /var/cache/apt/archives/.
If you ever need to install those packages again, apt-get will download them again rather than using those archived downloads. If you do not want to remove all downloaded packages but only the ones that are no longer available in your package repository, run this command:
# apt-get autoclean
For more information about APT and other useful commands, see this online documentation.