I suppose that it is not rare that tying for a solution the approach will be installing packages on the Raspberry PI environment, check how the stuff works then abandoning the solution to move to a different approach. This usually means sudo apt-get install a certain number of packages and the related dependencies occupying storage space.


Deciding that a certain approach is not what we want we can remove the packages in the same way se installed them:

$> sudo apt-get remove <package name>



Then in few times it may occur that we go low of storage space, especially when using only a 4 or 8 Gb microSD storage. As a matter of fact all the downloaded packages are cached by the linux operating system and these are not physically removed from the system when we simply remove the package. So, when we are sure that a set of packages are not needed it is a best practice to use a couple of apt-get features to really clean the system:


$>sudo apt-get autoremove


All cached packages and their dependencies are removed from the system definitely freeing lot of space. This command does not affect the components that are instead in use. As there are also cases where some other stuff (this maybe also consistent) downloaded by the update / upgrade keep files no more needed to the system. In many cases during an upgrade there are packages and components replaced by the newer one downloaded while the old are retained. Maybe that the system needs a rollout to the previous version, the user needs to save them for some reason and so on.


To definitely clean the system you can also launch the cleaning command


$>sudo apt-get autoclean


to remove all the unused packages from the system. You can check the available storage space in all the linux partitions with the command df (disk-free) generating a result similar to the example below.


pi@RPImaster ~ $ df

Filesystem     1K-blocks    Used Available Use% Mounted on

rootfs         919001196 4502680 867792852   1% /

/dev/root      919001196 4502680 867792852   1% /

devtmpfs          437856       0    437856   0% /dev

tmpfs              88432     292     88140   1% /run

tmpfs               5120       0      5120   0% /run/lock

tmpfs             176860       0    176860   0% /run/shm

/dev/mmcblk0p5     60479   14537     45943  25% /boot

/dev/mmcblk0p3     27633     442     24898   2% /media/SETTINGS_