Free Up Insane Amount of Disk Space in Ubuntu by Deleting Cached Package Files

When you install something in Ubuntu, package files are downloaded for installation but are not automatically deleted after installation is over. Instead the files will be used as a backup in case the application needs a reinstall in the future. But in most cases, this is a sheer waste of space especially if you are using a old laptop or a netbook with minimal amount of disk space.

There are a number of ways in which you could actually do the cleaning up operation of your Ubuntu desktop. Ubuntu Tweak is an awesome tool and its quite easy to free up disk space in Ubuntu using Ubuntu Tweak. But if you don't want to install another application to do the cleaning up, you have two ways to do it. One is the command line option(recommended) and other is by using Synaptic Package Manager.

Command Line Method

  • Deleting cached files using command line is quite easy. Firstly, check out how much space does cached package files actually occupy. Do the following in Terminal.
du -sh /var/cache/apt/archives
  • You will be quite surprised by the amount of space occupied by cached package files. In my case it was around 800MB. Do the following to clean it up.
sudo apt-get clean
  • Done.
Removing Cached Files via Synaptic Package Manager

  • Goto System - Administration - Synaptic Package Manager - Settings - Preferences.
  • Goto the 'Files' tab.
  • Simply press the 'Delete Cached Package Files' button to delete them all. You could also disable caching of package files by selecting the option 'Delete downloaded packages after installation'.
  • Done. Hope it works flawlessly, let us know of you find any issues. [via howtogeek]