4

I have installed both flatpak and snap versions of several apps (I sometimes even have appimage and deb file of some other apps installed too) to find which one works better for me.

Now I want to remove all other versions and keep the one I have customized, etc.

Unfortunately I have problems opening gnome-software so that the answer to this question doesn't help me. Is there anyway to check an installed or rather running app is a flatpak, snap, or native?

Let me give an example. I have both native and flatpak Firefox installed. I opened both of them and found one better for me and customized it, logged in to my account, added all my bookmarks etc. I close the other one, and add the chosen one to favourites to launch it from the dash next time. Now I don't know which source was the one I chose and favourited, and I want to figure out wether the currently open and running one is the snap version, the flatpak one, etc. so that I can remove that in Terminal. (AND I don't have access to gnome software app.)

Ubuntu 22.10 Gnome 43.1

1 Answers1

6

There are several ways to check with what package-manager a certain app is installed with:

  1. Use list commands in the terminal with the different package-managers to see if the app is listed in that list.

    For Snaps, use snap list

    For Flatpaks, use flatpak list

    And for native installed apps use dpkg -l

    Alternatively you can add the <app-name> in the end of every command to see if specifically that app is on the list of the prompted package-manager. For example, use flatpak list | grep <app-name> to see all installed apps flagged with that name or letter. For Snap use snap list <app-name>, and for native apps use dpkg -l <app-name>.


  1. You can use this custom grep command to sort all flagged installed apps into their package-manager:

    ( echo -e "\033[1m\033[4m\033[34mSnap packages:\033[0m"; snap list | grep -v Name | awk '{print "  "$1}'; echo ""; echo -e "\033[1m\033[4m\033[34mFlatpak packages:\033[0m"; flatpak list | grep -v Application | awk '{print "  "$1}'; echo ""; echo -e "\033[1m\033[4m\033[34mNative packages:\033[0m"; dpkg -l | grep -v "^ii" | grep -v "^rc" | awk '{print "  "$2}' ) | grep -i --color=always <app-name> || echo -e "\033[1m\033[31mNo results found.\033[0m"
    

    The command might seem long and complex, but it will list in a very nice way all of the resulted apps and the package-manager they were installed with. All you need to do is to enter the command in the terminal, replace <app-name> in the command with your selected app and it will sort it for you.


Also if you want to check whether the current running application is Flatpak, Snap or native, just open the System Monitor and search for the running application, and then look at the Command Line tab and see by the path whether it's Snap, Flatpak or native.

Hopefully this answer helped you and have good luck!

  • That was a wonderful, clearly explained, helpful answer. thank you very much. I will try to create shortcut/alias for the long and complex but useful command you mentioned and use it whenever I need. All I need to do is making it ask for the app name to replace it in the command. – Masoud Borbor Mar 16 '23 at 12:04