How to completely remove flatpak

I have removed flatpak with sudo apt-get purge flatpak; however, if I run locate flatpak I find several files and several directories. Can I remove them all with rm -r or there is a "better" way? If so, how do I have to do that?

Edit

Since my output is 21909 rows long and, as @mook765 noted, nobody will ever be so crazy to read them all I think I should reformulate the question as follows: if I had a normal installation of flatpak, what would be the best way to remove it and all its files and folders?


I'm assuming you didn't uninstall the run times that flatpak applications require. I would recommend reinstalling flatpak and running the following commands:

flatpak uninstall --unused

sudo apt-get remove --autoremove flatpak

sudo apt-get purge flatpak

This should erase the majority of the files left behind from flatpak. I had around 4000 after trying it out. I decided it wasn't for me and had to look for a few hours to find a way to remove the majority of the files. These three commands had reduced nearly 4000 files that dealt with flatpak to 197.

Hope this helps.


Flatpak applications and runtimes aren't removed when you uninstall the flatpak package using apt.

I'd rather reinstall flatpak, use it to remove any leftover Flatpak packages, and then purge it. On Ubuntu 20.04 Focal:

$ sudo apt install flatpak
$ flatpak uninstall --all
$ sudo apt purge --autoremove flatpak

You can look at /var/lib/flatpak/ to check that everything has been removed. You may also need to reboot or logout/login to update application launchers.