Flathub portability noob question

If I have 2 machines running different distros, both of which have flathub set up with KDE Discover, is there an easy way to export a list of apps installed with Flathub from one machine, and then bulk install them on the other? Like maybe piping flatpak-list to a text file on one machine, and then using that file with flatpak-install on the other machine

If you want a list of all apps that you can save and put into a flatpak install on the other device, you could use this:

flatpak list --app --columns=application | tail -n +1 | tr '\n' ' '

To break this down:

  • flatpak list --app --columns=application will only list installed apps (no runtimes) and only list their application id
  • tail -n +1 takes that list and removes the header line
  • tr '\n' ' ' converts the newlines of the list into spaces

You should then be able to save the output and use it on the other device to install the same apps as on the first device.

2 Likes

So I put the output of that in a file (say, apps.txt) and then I can copy it to the destination machine and do cat apps.txt | flatpak install ?

Almost.

Since flatpak install does (to my knowledge) not support pipes in this way, this command would be better:

flatpak install $(cat apps.txt)

This runs cat apps.txt first and puts the output in as argument for flatpak install.