Package Management – How to Remove Cached .deb Files

aptpackage-management

I think once we get the packages with apt-get it stores in /var/cache/apt/archives . Is it safe to remove the archives files to save space?
Can we remove other files as well to save some space?

Best Answer

I think it's safe to remove the archives files. So if you want to free up disk space this are my recommendations:

To delete downloaded packages (.deb) already installed (and no longer needed)

sudo apt-get clean

To remove all stored archives in your cache for packages that can not be downloaded anymore (thus packages that are no longer in the repository or that have a newer version in the repository).

sudo apt-get autoclean

To remove unnecessary packages (After uninstalling an app there could be packages you don't need anymore).

sudo apt-get autoremove

To delete old kernel versions

sudo apt-get remove --purge linux-image-X.X.XX-XX-generic

If you don't know which kernel version to remove

dpkg --get-selections | grep linux-image

Source: Limpiando Ubuntu: comandos y programas (actualizaciĆ³n) & How do I free up disk space?

Related Question