EDIT: This is not a duplicate as this question is the reverse of what the other question is asking. Here we know what is the application and we want to find its .desktop
file that can be located in non standard places also. While the other question is about where the .desktop
files can be placed.
I want to open images from an FTP server in the default image viewer rather than in the browser, so I wanted to know the path of default image viewer desktop file in Ubuntu. I tried the following:
cd -- /usr/share/applications
/usr/share/applications
$ find . -name '*.desktop' | grep image
./gnome-disk-image-mounter.desktop
./gnome-disk-image-writer.desktop
$ find . -name '*.desktop' | grep view
./calibre-ebook-viewer.desktop
./calibre-lrfviewer.desktop
./evince-previewer.desktop
./shotwell-viewer.desktop
./okularApplication_ghostview.desktop
./gcr-viewer.desktop
./gnome-info-overview-panel.desktop
./org.gnome.font-viewer.desktop
./paraview.desktop
But I still couldn't find it. Are there any other locations where the desktop files are stored?
A much faster and more universal search is with
locate
command:locate
can search millions of files in a few seconds where it would takefind
many many minutes:Notice how
grep
was eliminated from original method andfind
command was ammended.The disadvantage of
locate
is the database is updated daily. If you just installed the application you are searching for today, you will first need to run:The name of the
desktop
file alone may not reveal sufficient information. The fundamental approach is to search the content of all.desktop
files of the system to find the relevant one(s).For example, the image viewer is displayed as
Image Viewer
in the Applications overview. Gnome Shell obtained that label from the.desktop
file. To find the.desktop
file (or files) that contains this string, executeThis uses
find
to find all.desktop
files on the system. For each of the found files,grep
is invoked, which searches for a string in the file, in this exampleImage Viewer
. The2>/dev/null
suppresses the permission errors you inevitably get searching the root drive without root permissions.Well my solution is very easy and here is how you do it if you are looking for the application with a icon in your apps
for Example i want to find location for some apps in my Ubuntu --- i want to find the desktop file for Google Chrome
But it only works for the apps inside
/usr/share/applications