how to completely remove snap and replace with flatpak?

sudo apt purge snapd gnome-software-plugin-snap 

Thanks to doug. It feels so clean now, all snap removed.

screenshot


Remove snap

Probably for people who just hope Canonical give up with Snap/snapcraft:

# stop snapd services
sudo systemctl stop snapd && sudo systemctl disable snapd

# purge snapd
sudo apt purge -y snapd gnome-software-plugin-snap

# remove no longer needed folders
rm -rf ~/snap
sudo rm -rf /snap /var/snap /var/lib/snapd /var/cache/snapd /usr/lib/snapd

# prevent reinstall
sudo apt-mark hold snap snapd
cat <<EOF | sudo tee /etc/apt/preferences.d/snapd
Package: snapd
Pin: origin *
Pin-Priority: -1
EOF

Sources:

  • How to uninstall snap?
  • How to remove snap completely without losing the Chromium browser?

Install Flatpak

  1. Install Flatpak on Ubuntu 18.10 or later (check here for older versions).

    sudo apt install flatpak
    
  2. Install the Software Flatpak plugin: The Flatpak plugin for the Software app makes it possible to install apps without needing the command line. To install, run:

    sudo apt install gnome-software-plugin-flatpak
    
  3. Add the Flathub repository: Flathub is the best place to get Flatpak apps. To enable it, run:

    flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
    
  4. Restart your system (reboot).