On a current (2018-06) Debian sid, installing .deb packages via apt-get or aptitude or synaptic caches the downloaded packages in /var/cache/apt/archives:

# rm -f /var/cache/apt/archives/nano_*
# aptitude install nano
# aptitude purge nano
# ls /var/cache/apt/archives/nano_*


Using the frontend apt does not cache the downloaded files anymore:

# rm -f /var/cache/apt/archives/nano_*
# apt install nano
# ls /var/cache/apt/archives/nano_*
ls: cannot access '/var/cache/apt/archives/nano_*':
      No such file or directory

So switching between two mutually exclusive sets of packages re-downloads everything. How can I change the settings of apt to keep the downloaded files?


Create a /etc/apt/apt.conf.d/01keep-debs file with the following content:

Binary::apt::APT::Keep-Downloaded-Packages "true";  

Your *.deb should be kept in /var/cache/apt/archives/* directory.

Or use it as option to keep the debs files for some selected packages.

 apt -o APT::Keep-Downloaded-Packages="true" install some_package.
| improve this answer | |
  • 2
    Thank you. And FTR, this is option is not documented in the man-page for apt.conf, apt-config or apt_preferences. – finite graygreen Jun 3 '18 at 12:55
  • 1
    Thanks! The ready-to-copy-paste version could be echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' | tee -a /etc/apt/apt.conf.d/01-custom-local or if you need sudo then echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' | sudo tee -a /etc/apt/apt.conf.d/01-custom-local – mivk Feb 2 '19 at 10:56

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.