Here’s how to clean up Flatpak apps to reclaim your precious disk space. Follow along.
Flatpak (like Snap) packages runs in sandbox mode. By design, it takes a considerable amount of disk space for an individual application, even if it is a smaller one. For example, a simple Test editor or a basic image annotator application can take up more than 100+ MB of storage space.
It’s how Flatpak, or even Snap operates fundamentally. It pulls all dependencies for an app and runs independently. The advantage of this design is – you do not need to worry about dependencies, updates. All you need to do is install and run. On the contrary, it takes up huge amount of disk space.
And if you are running Ubuntu, elementary OS or any distribution for longer period, you would be surprised that over time, Flatpak keeps on taking up more space.
Hence, in this guide, we will give you some commands which you can run it by yourself to clean up flatpak apps.
Clean Up Flatpak
Where Flatpak packages are installed?
When you install a Flatpak package, it gets installed in
/var/lib/flatpak. All the installed files, metadata, application files, runtime files contained in this directory. Also, user installation directory contains Flatpak data – that is –
How to find out size of Flatpak apps?
There are several commands and parameters of “flatpak” which you can combine to get desired result to list the applications, size and type of installation. Here are some of the examples.
- Verify the size of
/var/lib/flatpak. But as it is being used by all Flatpak apps plus runtimes, you may not be able to recover entirely.
du -h /var/lib/flatpak
- If you have Disk Usage Analyzer, you can verify simply visiting the above directories.
You can use any of the following commands to view the size of installed flatpak packages.
- View all the installed flatpak with name and installed size.
flatpak --columns=name,size list
- List all installed flatpak with installation type, size and application ID.
flatpak --columns=app,name,size,installation list
- View only the flatpak installed by you.
flatpak --columns=name,size --user list
Remember, there are two types of flatpak that may exist in your system. Some of them may be part of OS itself. And some of them are installed by you.
Commands to Clean up
- Use the following command to uninstall flatpak packages that are not in use. This is a safe command which you can try.
flatpak uninstall --unused
Using the above command, I have freed up around 1GB+ in my test system.
- If you want to uninstall a specific Flatpak package, use the following command. Change the application ID with the app name. You can find the app name in above list size commands.
flatpak uninstall <application ID>
- The following command remove all flatpak packages from your system. Try not to run it, unless you are very sure what you are doing. This may break your system, depending on your configuration.
flatpak uninstall --all
Finally, there are some flatpak cache files in path /var/tmp/flatpak-cache-*. Although, the size may not be significant. But you can still remove them.
sudo rm -rfv /var/tmp/flatpak-cache-*
For more details about flatpak commands, visit the official guide. And let me know, using the comment box below, whether this helped you to clean up some space. If you are looking for cleaning up Snap packages, the guide is available here.