HOW TO CLEAR THE APT CACHE ON A LINUX SYSTEM

The apt package manager saves a list of packages so you don't have to download it every time. When a Linux installation reaches a certain age the apt cache can take up several tens of gigabytes. APT does not clean the cache automatically, so it may contain obsolete packages in the list that can no longer be installed. You can check the size of the apt cache with the following command:

sudo du -sh /var/cache/apt

If the size exceeds 3GB, the apt cache probably contains obsolete packages. You can clear the cache with the auto-clean option:

sudo apt-get autoclean

If you want to remove the cache completely:

sudo apt-get autoclean

This should be one of the things to look at when you have a server that is running low on space, as you can easily recover quite a few GB on disk. I have recovered almost 8GB.

Tags

Have Any Project in Mind?

If you want to do something in Drupal maybe you can hire me.

Either for consulting, development or maintenance of Drupal websites.