var/cache/apt/archives occupying huge space

159,570

Solution 1

You don't need to keep them around if you don't want them. Executing a

sudo apt-get clean

will clean out the directory.

Solution 2

Seems like

sudo apt-get autoclean

is a better choice than

sudo apt-get clean

autoclean will only remove "useless" archives

From the man page:

Like clean, autoclean clears out the local repository of retrieved package files. The difference is that it only removes package files that can no longer be downloaded, and are largely useless. This allows a cache to be maintained over a long period without it growing out of control. The configuration option APT::Clean-Installed will prevent installed packages from being erased if it is set to off.

Solution 3

You can adjust settings in Synaptic package manager, menu Settings/Preferences, the Files tab. From there you can also delete the cache.

Solution 4

It is better to save packages elsewhere then clean it up [Jorge Castro's process]. When you reinstall OS or a package it will not download again which save time and bandwidth. apt-get first check require packages in local storage[/var/cache/apt/archives] if does not exists then download else just do install. So you can save packages for future uses.

Share:
159,570

Related videos on Youtube

Vivek
Author by

Vivek

Updated on September 18, 2022

Comments

  • Vivek
    Vivek over 1 year

    I am in the process of cleaning up my system. And I see a lot of space occupied by this folder /var/cache/apt/archives (1.5GB). Is it absolutely necessary to keep all these archives?

  • Bruno Pereira
    Bruno Pereira over 12 years
    I doubt he will need all the 1,5Gb of updates to use on a new system!
  • ignis
    ignis over 11 years
    They can be moved on a CD or other support, so they don't waste space on the local drive. This is called a 'local repository'.
  • syntaxerror
    syntaxerror over 9 years
    Save packages elsewhere? Yes, that's what I've done here. I've mv'd the whole /var/cache/apt/archives to /usr/tmp/apt-archive-cache and set an archives symbolic link in /var/cache/apt accordingly. Since especially audacity likes to store temporary files in /var, this directory should always be taken care of so that it never runs out of space.
  • alanaktion
    alanaktion over 9 years
    I'm actually seeing the opposite, autoclean basically emptied the directory while clean did nothing.
  • Cristiano
    Cristiano almost 8 years
    Why after I have issued this command I still can see the cached deb files in the Ubuntu Tweek tool?
  • mtk
    mtk over 7 years
    just brilliant... The first things i found so easy .. :p
  • gerardw
    gerardw almost 5 years
    No, clean is the better choice if you want to save disk space. My testing (ubuntu 18) showed clean removed 18G when autoclean removed little (less than 1 GB, if that)
  • Doktor J
    Doktor J over 4 years
    @Cristiano it might be that the tool is in a partially-installed state and so apt thinks it needs to keep it.
  • Aquarius Power
    Aquarius Power over 3 years
    "delete downloaded packages after installation" is what I needed, thx!
  • Aquarius Power
    Aquarius Power over 3 years
    useless archives to me are installed ones (I download only most times), by not specifying what "useless" actually means makes that option useless (pun intended :))
  • Aquarius Power
    Aquarius Power over 3 years
    "delete downloaded packages after installation" is what I needed, thx! a pity the clean button ignores our option see askubuntu.com/questions/1300676/…
  • Admin
    Admin almost 2 years
    autoclean is perfect after an upgrade. It keeps current packages, but deletes old ones from the previous version. Note that you can use the -s (or --simulate or --dry-run) option to see what would be deleted without actually doing it.