Ubuntu doesn’t require a lot of disk space to install, but if you’ve installed in a virtual machine with a small virtual drive, or partitioned most of your disk for your /home, you may need to free up some space on a system occasionally.

The APT package management system keeps a cache of DEB packages in /var/cache/apt/archives. Over time this cache can grow quite large and hold a lot of packages you don’t need.

For example, I installed AWN from a repository that frequently updates to the latest development versions. As a result, /var/cache/apt/archives contained 11 different versions of the package avant-window-navigator-trunk.

It’s easy to clear APT’s cache using apt-get. The autoclean command removes packages that are definitely useless (packages that are outdated):
sudo apt-get autoclean

Running autoclean reduced the cache’s size from 378.7 MB to 293.3 MB on my main system. (85.4 MB freed.)

The clean command clears the cache entirely:
sudo apt-get clean

Running clean emptied the cache of all 378.7 MB of packages.

Clearing APT’s cache completely shouldn’t have any adverse effects other than if you reinstall a package, it will first need to be redownloaded.

[update] Commenter EarloftheWest has pointed out that Synaptic includes options for deleting downloaded packages and a button to clear the cache. These can be found in Synaptic under Settings->Preferences->Files.


Related Posts