0
0
Linux CLIscripting~5 mins

snap and flatpak in Linux CLI - Commands & Configuration

Choose your learning style9 modes available
Introduction
Installing software on Linux can be tricky because different distributions use different package systems. Snap and Flatpak are tools that let you install apps easily and safely, no matter which Linux version you use.
When you want to install the latest version of an app regardless of your Linux distribution.
When you want to try an app without worrying about breaking your system.
When you want apps to be isolated so they don't interfere with each other or your system.
When you want to update apps automatically without manual intervention.
When you want to install apps that are not available in your Linux distribution's default store.
Commands
This command installs the VLC media player using Snap. Snap packages work on many Linux systems and include all needed dependencies.
Terminal
sudo snap install vlc
Expected OutputExpected
vlc 3.0.18 from VideoLAN✓ installed
This command lists all the Snap packages installed on your system so you can see what apps you have.
Terminal
snap list
Expected OutputExpected
Name Version Rev Tracking Publisher Notes vlc 3.0.18 2345 stable videolan✓ -
This command installs the GIMP image editor from Flathub using Flatpak. The -y flag automatically confirms the installation.
Terminal
flatpak install flathub org.gimp.GIMP -y
Expected OutputExpected
Looking for matches… Required runtime for org.gimp.GIMP/x86_64/stable found in remote flathub Installing… Installation complete.
-y - Automatically confirm installation without asking
This command shows all Flatpak apps installed on your system so you can check what you have.
Terminal
flatpak list
Expected OutputExpected
Name Application ID Version Branch Installation GIMP org.gimp.GIMP 2.10.30 stable system
Key Concept

If you remember nothing else, remember: Snap and Flatpak let you install and run apps safely and easily on any Linux system without worrying about dependencies.

Common Mistakes
Trying to install a Snap package without sudo privileges
Snap requires admin rights to install apps, so the command will fail without sudo.
Always use sudo before snap install commands to have the needed permissions.
Not adding the Flathub repository before installing Flatpak apps
Flatpak needs the Flathub remote repository to find many popular apps; without it, installation fails.
Run 'flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo' once before installing apps.
Confusing Snap and Flatpak commands or mixing their package names
Snap and Flatpak are different systems with different commands and app IDs; mixing them causes errors.
Use snap commands for Snap packages and flatpak commands for Flatpak packages, and use the correct app names.
Summary
Use 'sudo snap install appname' to install apps with Snap.
Use 'snap list' to see installed Snap apps.
Use 'flatpak install flathub appid -y' to install apps with Flatpak from Flathub.
Use 'flatpak list' to see installed Flatpak apps.
Snap and Flatpak help run apps safely and easily on any Linux distribution.