Introduction

Flatpak, a popular package management system, provides a sandboxed environment for running applications. However, this sandboxed nature can result in the accumulation of significant disk space over time. In this guide, we will walk you through the process of cleaning up Flatpak apps to free up precious disk space on your Linux system.

Where Flatpak Packages are Installed

When you install a Flatpak package, it is stored in two primary locations on your system:

1. System Installation Directory: `/var/lib/flatpak

This directory contains all the files, metadata, application files, and runtime files shared among all Flatpak apps.

2\. User Installation Directory: ~/.local/share/flatpak\

Flatpak data specific to each user, including installed applications, is stored in this directory.

How to Find Out the Size of Flatpak Apps

Before proceeding with cleanup, it's helpful to identify the disk space occupied by Flatpak apps. Here are some commands you can use:

1. Check the size of /var/lib/flatpak

`bash

du -h /var/lib/flatpak

`

2\. Use Disk Usage Analyzer\

Alternatively, you can visually inspect the size of Flatpak data by using a disk usage analyzer tool.

3\. List installed Flatpak packages

  • by name and size

`bash

flatpak --columns=name,size list

`

  • by app, name and size

`bash

flatpak --columns=app,name,size,installation list

`

Output is like this:

`bash

Application ID Name Installed size Installation\

io.podman_desktop.PodmanDesktop Podman Desktop 306.5 MB system\

org.fedoraproject.Platform Fedora Platform 1.8 GB system\

org.fedoraproject.Platform Fedora Platform 1.9 GB system\

org.fedoraproject.Platform Fedora Platform 2.0 GB system\

org.fedoraproject.Platform Fedora Platform 2.0 GB system\

org.freedesktop.Platform Freedesktop Platform 576.2 MB system\

org.freedesktop.Platform.GL.default Mesa 385.2 MB system\

org.freedesktop.Platform.GL.default Mesa (Extra) 385.2 MB system\

org.freedesktop.Platform.VAAPI.Intel Intel 53.3 MB system\

org.freedesktop.Platform.openh264 openh264 790.0 kB system\

org.geany.Geany Geany

`

  • by name and size per user

`bash

flatpak --columns=name,size --user list

`

Commands to Clean Up Flatpak Apps

Now, let's proceed with cleaning up Flatpak apps to reclaim disk space:

  • Uninstall Unused Flatpak Packages:

`bash

flatpak uninstall --unused

``

This command safely removes Flatpak packages that are no longer in use.