Cyberithub

21 Popular Flatpak command examples on Linux

Advertisements

In this article, I will take you through 21 Popular flatpak command examples on Linux. If you are a Linux User/Professional then you might be aware of System Package Managers like dpkg, pacman, snappy, apk-tools etc. Flatpak is another very popular Package Manager which manages your application download, installation, running and removal on your Linux System.

You might be wondering why to use flatpak when you have other whole lot of Package Managers out there. Well, this is because flatpak comes with below added advantage over others.

  • Universality: Flatpak allows applications to be installed and run on virtually any Linux distribution. This includes non-GNU distributions, systemd-free distributions, distributions with a read-only operating system (OS), and various architectures without the developer needing the relevant hardware on hand.
  • Space for innovations: Flatpak facilitates distribution maintainers to focus on their goals to innovate their distribution.
  • Stability: breakage in a Flatpak application will not risk the system from breaking. This is because Flatpak applications and runtimes are contained to not interfere with the system altogether.
  • Rootless install: elevated privileges are not required when installing a Flatpak application or a runtime.
  • Sandboxed applications: one of Flatpak’s main goals is to increase the security of desktop systems by isolating applications from one another. This is achieved using sandboxing and means that, by default, applications that are run with Flatpak have limited access to the host environment. More on flatpak.

Synopsis

flatpak [OPTION...] {COMMAND}

21 Popular flatpak command examples on Linux

Flatpak command examples on Linux

Also Read: 5 Easy Steps to Install Flatpak on Ubuntu 20.04

Example 1: How to Check Flatpak version

If you want to check flatpak version, then you need to use flatpak --version command as shown below.

root@localhost:~# flatpak --version
Flatpak 1.6.5

 

Example 2: How to List all the Packages

To check all the flatpak installed packages, you need to use flatpak list command as shown below.

root@localhost:~# flatpak list
Name                       Application ID                      Version  Branch Installation
Mesa                       org.freedesktop.Platform.GL.default 21.1.1   20.08  system
openh264                   org.freedesktop.Platform.openh264   2.1.0    2.0    system
Adwaita theme              org.kde.KStyle.Adwaita                       5.15   system
KDE Application Platform   org.kde.Platform                             5.15   system
VLC                        org.videolan.VLC                    3.0.14   stable system

 

Example 3: How to Search a Package Using flatpak command

If you want to search a package in remote repository then you need to use flatpak search <package_name> syntax. In this example, we are searching vlc package in remote repository using flatpak search vlc command as shown below.

root@localhost:~# flatpak search vlc
Name                          Description                                                                 Application ID              Version   Branch  Remotes
MakeMKV plugin for VLC        Provides MakeMKV features for direct Blu-ray playback in VLC. Use MakeMKV … …ideolan.VLC.Plugin.makemkv           3-20.08 flathub
MakeMKV plugin for VLC        Provides MakeMKV features for direct Blu-ray playback in VLC. Use MakeMKV … …ideolan.VLC.Plugin.makemkv           3-19.08 flathub
Bluray Java menus (BDJ) plug… Provides Bluray Java menus (BDJ) support in VLC.                            org.videolan.VLC.Plugin.bdj           3-20.08 flathub
Bluray Java menus (BDJ) plug… Provides Bluray Java menus (BDJ) support in VLC.                            org.videolan.VLC.Plugin.bdj           3-19.08 flathub
VLC                           VLC media player, the open-source multimedia player                         org.videolan.VLC             3.0.14   stable  flathub
FDK-AAC Encoding Plugin for … Provides better AAC encoding and HE profiles support.                       …videolan.VLC.Plugin.fdkaac           3-20.08 flathub
FDK-AAC Encoding Plugin for … Provides better AAC encoding and HE profiles support.                       …videolan.VLC.Plugin.fdkaac           3-19.08 flathub

 

Example 4: How to Install a Package using flatpak command

If you want to install an application then you need to use flatpak install <ApplicationID> syntax. In this example, we are installing VLC application using flatpak install org.videolan.VLC command as shown below.

root@localhost:~# flatpak install org.videolan.VLC
Looking for matches…
Found similar ref(s) for ‘org.videolan.VLC’ in remote ‘flathub’ (system).
Use this remote? [Y/n]: Y

org.videolan.VLC permissions:
ipc network pulseaudio x11 devices file access [1] dbus access [2]
bus ownership [3]

[1] host, xdg-config/kdeglobals:ro, xdg-run/gvfs
[2] com.canonical.AppMenu.Registrar, org.freedesktop.Notifications, org.freedesktop.ScreenSaver, org.freedesktop.secrets, org.kde.kwalletd,
org.kde.kwalletd5, org.mpris.MediaPlayer2.Player
[3] org.mpris.MediaPlayer2.vlc


ID Branch Op Remote Download
1. [✓] org.videolan.VLC.Locale stable i flathub 7.4 kB / 13.4 MB
2. [✓] org.videolan.VLC stable i flathub 26.9 MB / 31.6 MB

Installation complete.

 

Example 5: How to Uninstall an application using flatpak command

If you want to uninstall an application then you need to use flatpak uninstall <ApplicationID> syntax. In this example we are uninstalling VLC application using flatpak uninstall org.videolan.VLC command as shown below.

root@localhost:~# flatpak uninstall org.videolan.VLC


ID Branch Op
1. [-] org.videolan.VLC stable r
2. [-] org.videolan.VLC.Locale stable r

Uninstall complete.

 

Example 6: How to Check Flatpak history

To check all the operations performed by flatpak in the past, you can use flatpak history command as shown below.

root@localhost:~# flatpak history
Time            Change         Application                         Branch Installation Remote
May 31 17:49:22 add remote                                                 system      flathub
May 31 17:50:15 pull           org.freedesktop.Platform.GL.default 20.08   system      flathub
May 31 17:50:15 deploy install org.freedesktop.Platform.GL.default 20.08   system      flathub
May 31 17:50:18 pull           org.freedesktop.Platform.openh264   2.0     system      flathub
May 31 17:50:18 deploy install org.freedesktop.Platform.openh264   2.0     system      flathub
May 31 17:50:21 pull           org.kde.KStyle.Adwaita              5.15    system      flathub
May 31 17:50:21 deploy install org.kde.KStyle.Adwaita              5.15    system      flathub
May 31 17:50:22 pull           org.kde.Platform.Locale             5.15    system      flathub

 

Example 7: How to Update an application using flatpak command

If you want to update an application then you need to use flatpak update <ApplicationID> syntax. In this example, we are updating VLC application using flatpak update org.videolan.VLC command as shown below.

root@localhost:~# flatpak update org.videolan.VLC
Looking for updates…
Nothing to do.

 

Example 8: How to Check flatpak remote

If you want to check all the configured Flatpak remote repository then you need to use flatpak remotes command as shown below.

root@localhost:~# flatpak remotes
Name    Options
flathub system

 

Example 9: How to List Flatpak Configuration 

If you want to check all the flatpak configuration then you need to use flatpak config --list command as shown below.

root@localhost:~# flatpak config --list
languages: *unset* (default: en)
extra-languages: *unset*

 

Example 10: How to Set Languages for Flatpak Installation

If you want to set languages for Flatpak installation, then you can do that from flatpak config command. First check the current set languages using flatpak config --list command. As you can see below, it is currently unset.

root@localhost:~# flatpak config --list
languages: *unset* (default: en)
extra-languages: *unset*

So to use a preferred language like English, you need to use flatpak config --set languages "en" command. You can also see from above output that the default language is also English.

root@localhost:~# flatpak config --set languages "en"

Now if you again verify using flatpak config --list command, it will show as en.

root@localhost:~# flatpak config --list
languages: en (default: en)
extra-languages: *unset*

 

Example 11: How to Check all the Information about an Application

If you want to check all the information about an application then you need to use flatpak info <Application ID> syntax. In this example we are listing all the information about VLC application using flatpak info org.videolan.VLC command as shown below.

root@localhost:~# flatpak info org.videolan.VLC

VLC - VLC media player, the open-source multimedia player

ID: org.videolan.VLC
Ref: app/org.videolan.VLC/x86_64/stable
Arch: x86_64
Branch: stable
Version: 3.0.14
License: GPL-2.0+
Origin: flathub
Collection: org.flathub.Stable
Installation: system
Installed: 82.3 MB
Runtime: org.kde.Platform/x86_64/5.15
Sdk: org.kde.Sdk/x86_64/5.15

Commit: e0d1ba3781c4d5136bacf1ec3ee7d2b76b3326b5776b26e061d8c136321bfa45
Parent: 5d5020575acac3d712b3bb20b69cde479a918d7778a3d055ead464e4fc0578a0
Subject: Update to 3.0.14 (#125) (81dfc6ed)
Date: 2021-05-27 22:48:21 +0000

 

Example 12: How to Run Flatpak Applications

If you want to run any flatpak applications then you need to use flatpak run <ApplicationID> syntax. In this example, we are running GNOME Clocks application using flatpak run org.gnome.clocks command as shown below.

21 Popular Flatpak command examples on Linux 2

Example 13: How to Check Flatpak Process

If you want to check all the running flatpak process then you need to use flatpak ps command as shown below.

root@localhost:~# flatpak ps
Instance  PID     Application     Runtime
738861919 4408 org.gnome.clocks org.gnome.Platform

 

Example 14: How to Kill Flatpak Process

To kill any flatpak process, first check all the processes using flatpak ps command as shown below. Here we see only one process i.e GNOME Clocks is currently running.

root@localhost:~# flatpak ps
Instance PID Application Runtime
738861919 4408 org.gnome.clocks org.gnome.Platform

So to kill this process we need to use flatpak kill org.gnome.clocks syntax as shown below.

root@localhost:~# flatpak kill org.gnome.clocks

Now if you again check the flatpak process using flatpak ps command then you will see the previous running is killed now.

root@localhost:~# flatpak ps

 

Example 15: How to Repair Flatpak Installation

If you want to repair flatpak installation then you need to use flatpak repair command as shown below. This command will take little bit time to finish, so you need to patient and wait till it finishes out.

root@localhost:~# flatpak repair
Working on the system installation at /var/lib/flatpak
Verifying deploy/runtime/org.freedesktop.Platform.GL.default/x86_64/20.08…
Verifying flathub:runtime/org.freedesktop.Sdk.Extension.openjdk8/x86_64/20.08…
Verifying flathub:app/org.videolan.VLC/x86_64/stable…
Verifying flathub:runtime/org.videolan.VLC.Locale/x86_64/stable…
Verifying deploy/app/org.gnome.clocks/x86_64/stable…
Verifying flathub:runtime/org.freedesktop.Platform.openh264/x86_64/2.0…
Verifying deploy/runtime/org.freedesktop.Sdk.Extension.openjdk8/x86_64/20.08…
Verifying deploy/runtime/org.kde.Platform.Locale/x86_64/5.15…
Verifying deploy/runtime/org.kde.KStyle.Adwaita/x86_64/5.15…

 

Example 16: How to Remove Unused Runtimes

In case you are keeping flatpak runtimes but not using them from quite some time then you can remove them by using flatpak uninstall --unused command as shown below.

root@localhost:~# flatpak uninstall --unused


ID Branch Op
1. [-] org.freedesktop.Sdk.Extension.openjdk8 20.08 r

Uninstall complete.

 

Example 17: How to Add Remote Repository

If you want to add any remote repository then you need to use flatpak remote-add command. In this example we are checking if flathub repo already exists, if not then only add this repo by using flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo command as shown below.

root@localhost:~# flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

 

Example 18: How to Delete Remote Repository

If you want to delete any remote repository then you need to use flatpak remote-delete <repo> syntax. In this example we are deleting flathub repo using flatpak remote-delete flathub command as shown below.

root@localhost:~# flatpak remote-delete flathub
The following refs are installed from remote 'flathub':

1) runtime/org.gnome.Platform.Locale/x86_64/40
2) runtime/org.freedesktop.Platform.GL.default/x86_64/20.08
3) app/org.gnome.clocks/x86_64/stable
4) app/com.github.micahflee.torbrowser-launcher/x86_64/stable
5) runtime/org.kde.KStyle.Adwaita/x86_64/5.15
6) app/org.videolan.VLC/x86_64/stable
7) runtime/org.kde.Platform/x86_64/5.15
8) runtime/org.videolan.VLC.Locale/x86_64/stable
9) runtime/org.gnome.Platform/x86_64/40
10) runtime/org.kde.Platform.Locale/x86_64/5.15
11) runtime/org.gnome.clocks.Locale/x86_64/stable
12) runtime/org.freedesktop.Platform.openh264/x86_64/2.0

Remove them? [y/n]:

 

Example 19: How to List Remote Applications and Runtimes

If you want to list all the remote applications and runtimes then you need to use flatpak remote-ls command as shown below.

root@localhost:~# flatpak remote-ls

 

Example 20: How to Check all the options available with Flatpak command

If you want to check all the options available with flatpak command then you need to use flatpak --help command as shown below.

root@localhost:~# flatpak --help
Usage:
flatpak [OPTION…] COMMAND

Builtin Commands:
Manage installed applications and runtimes
install Install an application or runtime
update Update an installed application or runtime
uninstall Uninstall an installed application or runtime
mask Mask out updates and automatic installation
list List installed apps and/or runtimes
info Show info for installed app or runtime
history Show history
config Configure flatpak
repair Repair flatpak installation
create-usb Put applications or runtimes onto removable media

Finding applications and runtimes
search Search for remote apps/runtimes

 

Example 21: How to Check the Man Page of Flatpak Command

If you want to check the man page of flatpak then you need to use man flatpak command as shown below.

root@localhost:~# man flatpak
FLATPAK(1) flatpak FLATPAK(1)

NAME
flatpak - Build, install and run applications and runtimes

SYNOPSIS
flatpak [OPTION...] {COMMAND}

DESCRIPTION
Flatpak is a tool for managing applications and the runtimes they use. In the Flatpak model, applications can be built and distributed
independently from the host system they are used on, and they are isolated from the host system ('sandboxed') to some degree, at runtime.

Flatpak can operate in system-wide or per-user mode. The system-wide data (runtimes, applications and configuration) is located in
$prefix/var/lib/flatpak/, and the per-user data is in $HOME/.local/share/flatpak/. Below these locations, there is a local repository in the repo/
subdirectory and installed runtimes and applications are in the corresponding runtime/ and app/ subdirectories

Leave a Comment