Whilst Linux in general is very good at being neat and tidy, devices such as the Raspberry PI, where resources can be much more limited than other computers can sometimes suffer – usually from lack of space (performance will be dealt with in another post).

If you’ve recently made changes – removed some packages, or manually updated some components you may find your disk-space getting a bit lower. One of the tools you can use is built into apt-get and allows it to scan and remove dependencies no longer required.

 

Simply run the following commands

sudo apt-get autoclean

#removes old archive files that might have been left behind (note you can use clean as well – however this can cause slowness as it removes all archive files and some may be needed again

sudo apt-get autoremove

#this removes any unused packages – often can be left behind if you remove a program which had optional dependencies, these are not always removed by the system – or other changes may have now marked them as unused.

The output of this will looking similar to this:

Claiming back some disk-space using apt-get autoremove
Claiming back some disk-space using apt-get autoremove

This gained me 300MB this time, but I’ve previously gained back 1.2Gigabytes.