When using apt, can I tell it to use other then /var/cache/apt location? I tried adding the following line in /etc/apt/apt.conf:

% cat /etc/apt/apt.conf
Dir::Cache /home/apt

and re-run apt but it still writes in /var/cache/apt

1 Answer 1


You can add one of the following lines to any file inside /etc/apt/apt.conf.d/ or to /etc/apt/apt.conf:

Dir::Cache{Archives /home/apt/}
Dir::Cache::Archives /home/apt;

This will store all partially/full downloaded .deb files inside /home/apt.

Dir{Cache /home/apt}
Dir::Cache /home/apt;

This will store pkgcache.bin, srcpkgcache.bin inside /home/apt and all partially/full downloaded .deb files inside /home/apt/archives

Remember to add enough privileges to _apt user to that directory, so that everything works properly.

You can see the whole configuration of apt with apt-config dump, for example:

> apt-config dump | grep Dir::Cache
Dir::Cache "/home/apt";
Dir::Cache::archives "archives/";
Dir::Cache::srcpkgcache "srcpkgcache.bin";
Dir::Cache::pkgcache "pkgcache.bin";
  • btw, if we specify a different location for archives , that could be other than the local sd card auto clean or clean using apt-get may not be required. Sep 28, 2019 at 12:00
  • 4
    This is confusing. You give to sets of lines. Which set is appropriate?
    – Ken Ingram
    Jan 21, 2020 at 10:11
  • 1
    If you want to cache as muich as possible, you probably want - Dir::Cache /home/apt; May 18, 2020 at 23:35
  • It's also confusing why each setting appears twice, once inside curlies and once with ::
    – usretc
    Dec 20, 2020 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.