Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Linux flatpak Command

Linux flatpak Command

Linux Command Reference Linux Command Reference


Flatpak is a software distribution and package management tool for Linux. It uses sandbox technology to let applications run in isolated environments. The main advantages of Flatpak include:


Flatpak basic concepts

Runtime

Provides the basic environment needed to run applications, similar to a container's base image.

Application

The actual software package, which depends on a specific runtime.

Remote

A server source that stores Flatpak applications, similar to the software repository of a traditional package manager.

Sandbox

An isolated environment in which applications run, restricting access to system resources.


Flatpak installation and configuration

Install Flatpak

Most Linux distributions can install Flatpak through their package manager:

Example

Ubuntu/Debian

sudo

apt

install

flatpak

Fedora

sudo

dnf

install

flatpak

Arch Linux

sudo

pacman

-S

flatpak

Add the Flathub repository

Flathub is the main Flatpak application repository:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Reboot the system

After installation, it is recommended to reboot so that environment variables take effect.


Common Flatpak commands

Search for applications

flatpak search 应用名称

Install an application

flatpak install 远程仓库 应用ID

For example, to install LibreOffice:

flatpak install flathub org.libreoffice.LibreOffice

List installed applications

flatpak list

Run the application

flatpak run 应用ID

Update applications

Update all installed applications:

flatpak update

Update a specific application:

flatpak update 应用ID

Unmount the application

flatpak uninstall 应用ID

View application information

flatpak info 应用ID

Repair Flatpak

If you encounter problems, you can try to repair:

flatpak repair


Advanced Flatpak usage

Install a specific version of an application

flatpak install 远程仓库 应用ID//版本号

View available versions

flatpak remote-info --log 远程仓库 应用ID

Manage remote repositories

List all configured remote repositories:

flatpak remotes

Delete a remote repository:

flatpak remote-delete 仓库名称

Sandbox permission management

View an application's permissions:

flatpak permissions

Modify an application's permissions:

flatpak override --权限选项 应用ID

For example, to allow an application to access the home directory:

flatpak override --filesystem=home org.gnome.Gedit

Run an older version of an application

flatpak run --commit=版本号 应用ID


Comparison of Flatpak and Snap

Feature Flatpak Snap
Developing Company GNOME/Community Canonical
Sandbox technology Bubblewrap AppArmor
Dependency Management Shared runtime Bundles all dependencies
Startup speed Faster Slower
Default repository Flathub Snap Store
System integration Good Average
Desktop environment support Native support for GNOME/KDE Universal
Number of applications Relatively Many less

Common Problem Solutions

1. Application fails to start

Try resetting the application:

Example

flatpak repair

flatpak run

--command

=

bash

Application ID  

Enter the application environment for debugging

2. Permission issues

Check and modify permissions:

Example

flatpak permissions

flatpak override --reset-permissions application-ID

3. Insufficient disk space

Clean up old versions and unnecessary runtimes:

flatpak uninstall --unused

4. Inconsistent themes

Install platform theme integration:

flatpak install org.gtk.Gtk3theme.主题名称


Practical Exercise

  1. Install the GIMP image editor:

    flatpak install flathub org.gimp.GIMP
  2. Run GIMP and verify the installation:

    flatpak run org.gimp.GIMP
  3. Check GIMP's permission settings:

    flatpak info org.gimp.GIMP
  4. Update all installed Flatpak applications:

    flatpak update
  5. Uninstall GIMP:

    flatpak uninstall org.gimp.GIMP

Summary

Flatpak provides a modern way to distribute applications on Linux, solving dependency conflicts and cross-distribution compatibility issues. Through this tutorial, you should have learned:

  1. Flatpak's basic concepts and working principles
  2. The syntax and usage of common commands
  3. Advanced management and troubleshooting techniques
  4. The complete workflow for installing and managing real applications

As more developers adopt Flatpak, it is becoming an integral part of the Linux ecosystem.


Linux Command Reference Linux Command Reference