Last updated on June 6, 2020 by Dan Nanni
apt-get
or aptitude
. How can I disable APT cache to save disk space on my Linux?When you install a package with apt-get
or aptitude
on a Debian-based system, the downloaded package is, by default, kept in the APT cache located at /var/cache/apt/archives
. This is really not necessary as you typically do not re-install the same package ever again. Over time, the content in /var/cache/apt/archives
will grow.
If you want to turn off the APT cache, so that downloaded packages are not kept there, you can create the following file in /etc/apt/apt.conf.d
.
$ sudo vi /etc/apt/apt.conf.d/02nocache
Dir::Cache ""; Dir::Cache::archives "";
At this point, apt-get
or aptitude
will no longer store downloaded .deb
files in the APT cache.
You can go head and empty the current APT cache.
$ sudo rm -rf /var/cache/apt/archives
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean