Common Used Flatpak Commands
Flatpak is a easy-to-use software package management utility for Linux end-users. This is a note for common used Flatpak commands.
1. Install Flatpak in Debian
Ths flatpak
package is available in Debian repository:
$ sudo apt update
$ sudo apt install flatpak
Check flatpak installation via:
$ flatpak --version
2. Flatpak package identifiers
Flatpak identifies each application and runtime using a unique three-part identifier, such as com.company.App
. The final segment of this address is the object’s name, and the preceding part identifies the developer, so that the same developer can have multiple applications, like com.company.App1
and com.company.App2
.
3. System versus user
Flatpak commands can be run either system-wide or per-user. Flatpak commands are run system-wide by default. It’s recommended to run in system-wide.
To run flatpak per-user, simply add the --user
option.
Commands behave in exactly the same way if they are run per-user rather than system-wide.
4. Basic commands
Note: See full list of Flatpak commands in the [Flatpak Command Reference].
4.1 List remotes
To list the remotes that you have configured on your system, run:
$ flatpak remotes
This gives a list of the existing remotes that have been added. The list indicates whether each remote has been added per-user or system-wide.
4.2 Add a remote
The most convenient way to add a remote is by using a .flatpakrepo
file, which includes both the details of the remote and its GPG key:
$ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Here, flathub
is the local name that is given to the remote. The URL points to the remote’s .flatpakrepo
file. --if-not-exists
stops the command from producing an error if the remote already exists.
4.3 Remove a remote
To remove a remote, run:
$ flatpak remote-delete flathub
In this case, flathub
is the remote’s local name.
4.4 Search
Applications can be found in any of your remotes using the search command. For example:
$ flatpak search gimp
Search will return any applications matching the search terms. Each search result includes the application ID and the remote that the application is in. In this example, the search term is gimp
.
4.5 Install applications
To install an application, run:
$ flatpak install flathub org.gimp.GIMP
Here, flathub
is the name of the remote the application is to be installed from, and org.gimp.GIMP
is the ID of the application.
Sometimes, an application will require a particular runtime, and this will be installed prior to the application.
The details of the application to be installed can also be provided by a .flatpakref file, which can be either remote or local. To specify a .flatpakref instead of manually providing the remote and application ID, run:
$ flatpak install https://flathub.org/repo/appstream/org.gimp.GIMP.flatpakref
If the .flatpakref
file specifies that the application is to be installed from a remote that hasn’t already been added, you will be asked whether to add it before the application is installed.
Since Flatpak 1.2, the install
command can search for applications. A simple:
$ flatpak install gimp
will confirm the remote and application and proceed to install.
4.6 Running applications
Once an application has been installed, it can be launched using the run command and its application ID:
$ flatpak run org.gimp.GIMP
4.7 Updating
To update all your installed applications and runtimes to the latest version, run:
$ flatpak update
4.8 List installed applications
To list the applications and runtimes you have installed, run:
$ flatpak list
Alternatively, to just list installed applications, run:
$ flatpak list --app
4.9 Remove an application
To remove an application, run:
$ flatpak uninstall org.gimp.GIMP
4.10 Troubleshooting
Flatpak has a few commands that can help you to get things working again when something goes wrong.
To remove runtimes and extensions that are not used by installed applications, use:
$ flatpak uninstall --unused
To fix inconsistencies with your local installation, use:
$ flatpak repair
Flatpak also has a number of commands to manage the portal permissions of installed apps. To reset all portal permissions for an app, use flatpak permission-reset
:
$ flatpak permission-reset org.gimp.GIMP
To find out what changes have been made to your Flatpak installation over time, you can take a look at the logs (since 1.2):
$ flatpak history