To the best of my knowledge, all shortcuts in the Unity Launcher have a corresponding *.desktop file. I have one shortcut (for skrooge) that doesn't have an icon. How can I find the *.desktop file corresponding to this shortcut so that I can add an icon to it?


It's probably sitting in /usr/share/applications/ but if you want to find every .desktop file on the system run this:

find / -name '*.desktop'


sudo updatedb
locate *.desktop

To find files with "skrooge" in their path or name, add a grep to the command:

locate *.desktop | grep -iR "skrooge"
| improve this answer | |
  • 23
    locate -i "*skrooge*.desktop". Though there's mainly three places unity will look for desktop files. ~/.local/share/applications, /usr/local/share/applications and /usr/share/applications. If there are desktop files for the same command in multiple places, it'll use the left-most of the three I listed. – geirha Mar 30 '12 at 14:32
  • Showed up as /usr/share/applications/kde4/skrooge.desktop. Thanks. :) – KOVIKO Mar 30 '12 at 15:08

The system stores the .desktop files in /usr/share/applications/. Unfortunately, if you open that folder in nautilus the .desktop files appears with the icon specified in the file and with the file name called out within the file. You also won't be allowed to edit these files by clicking on them and selecting edit.

To edit these files, you need to open that folder within a terminal window. Doing an ls command will show all the .desktop files with their actual names. When you locate the .desktop you wish to change, run gksudo gedit {file-name}.desktop.

It's normal practice to keep any .desktop files you create or edit in your home folder ~/.local/share/applications.

| improve this answer | |
  • Running from the terminal can be handier for some, but it is also possible to drag from nautilus into gedit or another text editor. – Jon Hanna May 1 '14 at 21:40
  • what's the point of the directory "~/.local/share/applications"? Files there don't seem to be used, not I cannot add them as "shortcut" to Unity. – Malachiasz Feb 8 '15 at 15:14
  • 3
    @Malachiasz Actually, the *.desktop files from ~/.local/share/applications are reloaded when session restarts. So, log out and log back in. Note that these are specific to that user. – akshay2000 Mar 21 '15 at 7:11
  • 1
    I also found this Q&A here on site useful: How to force Unity reload ~/.local/share/applications/ – hakre Sep 18 '17 at 18:19

Some additional details to supplement the other answers:

Typically, .desktop files for packages will be located in /usr/share/applications.

If you want, you could copy one to ~/.local/share/applications and edit it there without needing sudo. Items in ~/.local/share/applications will override matching items in /usr/share/applications and /usr/local/share/applications, but are only visible to your user.

Alternatively, you could place an edited copy in /usr/local/share/applications where it will override any in /usr/share/applications while also being visible to the entire system.

Note that you should not edit the .desktop files in /usr/share/applications directly; any changes you make will be automatically overwritten when the application is updated by the package manager.

Extracted from here

| improve this answer | |
  • +1, most complete answer out of all of them – Jon Bentley Feb 19 '19 at 0:22

I know I'm late to the party, but I have a faster solution than the one accepted as the answer:

find / -iname "*desktop" -type f -not -path "/media*" -exec grep -il skrooge '{}' ';' 2> /dev/null

It's faster because it doesn't search the data mounted file systems and most probably the desktop file is located in the system partition.

Moreover, it's more likely to find what the command from the accepted answer would miss. That's because the desktop files doesn't have to hold the application name. This command actually searches the text in every desktop file.

| improve this answer | |

Desktop files of snap packages can be found in /var/lib/snapd/desktop/applications/ and below /snap/.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.