Free up Memory - aceisace/Raspberry-Pi-Setup GitHub Wiki

Why free up memory?

If you are short on memory or know you won't need a specific package or program, you can remove it to free up space.

Finding out what takes the most space

Although a lot of programs are installed, randomly uninstalling them will hardly free up space. A more efficient way is to type dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n in the terminal.

Deleting packages

Once executed, a list containing all packages will be displayed, ordered from smallest (top) to largest (bottom). To remove the large, unused programs, use sudo apt-get remove --purge package-name to remove the package.

Usually, the most space-consuming packages are wolfram alpha and libreoffice (about 1 GB in total). These can be removed with:

sudo apt-get remove --purge libreoffice-* -y
sudo apt-get remove --purge wolfram-engine -y

Cleaning up

After uninstalling the packages, some packages are no longer required. These can be cleaned up with:

sudo apt-get clean
sudo apt-get autoremove -y