How to delete files from archives

11,514

The directory /var/cache/apt/archives contains cached downloaded packages (*.deb files - the applications you installed using apt or the Software Center, etc).

The most simple way to free up space here is to tell apt to remove these cached packages by running

sudo apt autoclean

This removes all old cached packages which are no longer downloadable only, but leaves those that could still be useful intact. To remove them all, use the one below instead:

sudo apt clean

Note that on older Ubuntu releases, you might have to use apt-get instead of apt.

Share:
11,514

Related videos on Youtube

OUBAD Anass
Author by

OUBAD Anass

Updated on September 18, 2022

Comments

  • OUBAD Anass
    OUBAD Anass almost 2 years

    I need to resize my ubuntu partition and I found that I need to install Gparted! And to do that I need to delete files from /var/cache/apt/archives because it's FULL!

    I can't do it manually! and from terminal I tried with different commands such as sudo rm -rf... but it doesn't delete files!

    Can you please help me!?

    $ df -h /var/cache/apt/archives
    Sys. de fichiers SIZE USED Dispo Uti% Monté sur
    /dev/sda5      8,9G    8,9G   0     100% /
    
    $ sudo du -h /var/cache/apt/archives
    4,0K    /var/cache/apt/archives/partial
    424M    /var/cache/apt/archives
    
    • George Udosen
      George Udosen over 7 years
      Try: sudo apt-get autoclean
  • OUBAD Anass
    OUBAD Anass over 7 years
    First, thank you for your answer! I did it! but still doesn't gave me any free space ...
  • Byte Commander
    Byte Commander over 7 years
    Can you give the output of df -h /var/cache/apt/archives and sudo du -h /var/cache/apt/archives please? Edit your question and add them there, then leave me a comment to notify me when you're done.
  • OUBAD Anass
    OUBAD Anass over 7 years
    There is the output of the 2 commands.
  • Byte Commander
    Byte Commander over 7 years
    Try sudo rm -f /var/cache/apt/archives/*.deb and then check the free space again. However, looking for other things occupying space which you don't need might be useful too, those few hundred MB will not save you much. Maybe growing the partition is also an option?
  • OUBAD Anass
    OUBAD Anass over 7 years
    The last command made all files disappear from /var/cache/apt/archives but when I tried to install Gparted, I got the same error wich is : not enough space on /var/cache/apt/archives !!! Yes Growing the partition is the reason why i'm doing all this! is there any other way to do it without ' sudo get install gparted ' ??
  • Byte Commander
    Byte Commander over 7 years
    Either you clean up stuff in other locations, or (even better for partitioning) you boot from a live CD (or USB, whatever you used to install Ubuntu) and run the GParted there.