How to prevent apt-get/aptitude keeping a cache
According to the documentation you can add a config file to /etc/apt/apt.conf.d/
named no-cache
containing Dir::Cache "";
and Dir::Cache::archives "";
according to manual of apt.conf
. There is a bug report raising issues with this method, and I don't recommend it.
There is one remaining method according to this tutorial:
echo 'DPkg::Post-Invoke {"/bin/rm -f /var/cache/apt/archives/*.deb || true";};' | sudo tee /etc/apt/apt.conf.d/clean
This will carry out an rm
command just before apt quits.