How to Clean Up Flatpak Apps to Clear Disk Space

3 min


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 – ~/.local/share/flatpak

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
Size of var-lib-flatpak
Size of var-lib-flatpak
Disk Analyzer Shows Flatpak size
Disk Analyzer Shows Flatpak size

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
flatpak list example 1
flatpak list example 1
  • List all installed flatpak with installation type, size and application ID.
flatpak --columns=app,name,size,installation list
flatpak list example 2
flatpak list example 2
  • View only the flatpak installed by you.
flatpak --columns=name,size --user list
flatpak list example 3
flatpak list example 3

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.

SEE ALSO:   How to Fix Flatpak Installation Error

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
clean up flatpak using unused switch
clean up flatpak using unused switch

Using the above command, I have freed up around 1GB+ in my test system.

var-lib-flatpak size is reduced
var-lib-flatpak size is reduced

  • 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.


We bring the latest tech, software news and stuff that matters. Stay in touch via Telegram, Twitter, YouTube, and Facebook and never miss an update!

Join our Telegram channel and stay informed on the move.

Also Read


Like it? Share with your friends!

Arindam

Creator of debugpoint.com. All time Linux user and open-source supporter. Connect with me via Telegram, Twitter, LinkedIn, or send us an email.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x