Deleted all three 'Files' .desktop files in /usr/share/applications/ - how do I get them back?

Whilst trying to fix a bug that gave me two occurrences of the 'Files' shortcut on the dash, one of which would never go away without a reboot, I navigated to /usr/share/applications/ and deleted all three desktop configuration files titled 'Files'. It turns out that none of these three were identical. One was 'org.gnome.Nautilus.desktop', another was 'nautilus-folder-handler.desktop', and the last was 'nautilus.desktop'. I've got no idea which of these were important, but now that they're gone it's broken a few things. How can I get them back?


Solution 1:

You could reinstall nautilus package with

sudo apt install --reinstall nautilus

This will give you back the /usr/share/applications/org.gnome.Nautilus.desktop file. I don't know where the others come from.

Try to look for them with apt-file

apt-file search /usr/share/applications/nautilus-folder-handler.desktop

and

 apt-file search /usr/share/applications/nautilus.desktop

Of course, you need apt-file installed. sudo apt install apt-file

Solution 2:

All these files came from nautilus package. See search results on https://packages.ubuntu.com :

  • nautilus-folder-handler.desktop
  • org.gnome.Nautilus.desktop
  • nautilus.desktop

So you need to reinstall the Nautilus package with:

sudo apt-get install --reinstall nautilus