There's a similar question on Stack Overflow, the reason my question is different is that I can't be certain that the path to an icon will always be the same (for example, some themes use SVG, some use PNG).

I would like to get a full path to an icon from a bash script knowing only its name.

What I mean by name is the one that's used in desktop entries.

For example, here's a line from a firefox.desktop file on my Ubuntu:


Somehow that's enough for my system to figure out exactly what the path to an icon is. How can I leverage this functionality in my scripts?

Just in case, I'm using Ubuntu 18.04.


A search for "gnome desktop file format":

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