How do I remove duplicate entries from Dash on 18.04?

Solution 1:

As you indicate, the two icons you see are connected to two versions of the software, one installed as a regular package, and one installed as a snap, the new software packaging system of Canonical, the company behind Ubuntu.

In principle, it would mean that both versions are installed on your system. It would then be sufficient to remove either the regular version or the snap version using Ubuntu Software. Removing software also takes away the icon. It should do so immediately, but to be sure, log out and log back in to verify whether the icon is gone.

If you are sure you did remove the software, but the icon stays in place, then either you have an icon defined in your user home folder, or something erroneous has happened at some time during the removal. Thus, first check your home folder (see next part in the answer) and if no icon is found there, try to reinstall the software using Ubuntu software, then removing it again hoping the removal is complete this time. If the icon is still not gone, you will have to remove it manually with administration privileges.

At a more technical level

If icons remain even after correctly uninstalling the software, you may want to remove them manually. The icons in the Dash are sourced from program launcher files. These are text files with a .desktop extension that describe how the program should be launched and what icon to use, among other things.

.desktop files can live under the user's home directory in the folder .local/share/applications. These items are only visible for the current user. Such icons are never removed automatically. Thus, if you keep having an icon after removal of software, it is quite likely there is a .desktop file remainng there.

The system wide location for regular application icons is /usr/share/applications. .desktop files for snap applications are maintained under /var/lib/snapd/desktop/applications/. Remove any of the .desktop files there to remove the corresponding icon in the Dash.