39

How can a user determine the path to an application being showed in launcher?

This is meant for non-programmers or experts, so terminal commands are not really suited for them. Why: we need to make our users able to drag files/folders on our applications, a standard OS feature entirely missing in Ubuntu.

xamiro
  • 535
  • 1
  • 5
  • 12
  • You ask for answers for non-programmers or experts. Pilot6's answer is pretty close to what you want - typically `.desktop` files for each app are located in `/usr/share/applications` but not always. Would you consider a shell script that I can write and show how to set up , or you do not want to deal with command-line at all ? The script can determine each file's location and exact location of the executable binary – Sergiy Kolodyazhnyy Jul 31 '16 at 13:01

3 Answers3

32

Go to /usr/share/applications or ~/.local/share/applications, right-click the application icon and click on "Properties".

I do not see a reason why a person who can't run a command in terminal would need a path.

Pilot6
  • 88,764
  • 91
  • 205
  • 313
  • 2
    There might also be user-specific .desktop files in `~/.local/share/applications`. – Byte Commander Jul 31 '16 at 12:48
  • It is a rare case, mostly when manually installed or wine related. – Pilot6 Jul 31 '16 at 12:49
  • Upvoted, but I agree with Byte Commander - you should mention other possible locations. For instance, Microchip's MPLAB IDE installs all of its files into `/opt` directory – Sergiy Kolodyazhnyy Jul 31 '16 at 12:56
  • `/opt` is not the case. It can be `/opt` as a path to an application, but a `.desktop` file can't be there. Unity will not see it. – Pilot6 Jul 31 '16 at 13:00
  • 1
    thanks, the reason for no terminal: being able to drag files/folders on a application, a standard OS feature totally absent in Ubuntu. – xamiro Jul 31 '16 at 15:21
  • @Serg: pilot6 is right, apps in /opt are still enumerated in /usr/share/applications – xamiro Jul 31 '16 at 15:24
  • OK , it appears to be so. – Sergiy Kolodyazhnyy Jul 31 '16 at 15:29
  • There is also, at least, `/usr/local/share/applications/` and `/usr/share/gnome/applications`. Take a look at `update-desktop-database`. – carandraug Jul 31 '16 at 17:03
  • 1
    The reason why people need paths is that even when a developer goes through the trouble to make a GUI they will still put a text field in there asking users to provide e.g. "the path to Google Chrome". It sucks, but it's still infinitely better than a terminal. – Andreas Oct 18 '17 at 11:55
  • another situation: I tried run texmaker in commandline it turns out to be some library linking issues so it didn't run at all. But when I enter through dashboard texmaker works just fine... It is super weird...so I need to figure out why. that's one reason one can't run an application in command line but need a path from dashboard specifically. – ArtificiallyIntelligence Jun 26 '19 at 00:02
21

In 18.04 and later launch an application by clicking on its icon in the Dash which is accessed by clicking the 9 dots icon in the lower left corner of the dock. Launch the System Monitor and make a note of the exact spelling of the name of the application that you just opened. Open the terminal and type:

type application-name

It takes only a few seconds to get the path to an application in Ubuntu 14.04 and later. Search for the application in the Dash and then drag the application's icon into the terminal. The application's full path will be shown in the terminal automatically. Dragging the icon into the terminal will also show the path to any file, folder, archive or anything else that has an icon.

In Ubuntu 20.04 and later drag and drop of files or directories doesn't work from the desktop, but does work in other locations including dragging from the desktop in Files file manager.

karel
  • 110,292
  • 102
  • 269
  • 299
13

You have to go to a terminal, I fear... Here's an example:

whereis gedit

which gives as output:

gedit: /usr/bin/gedit /usr/share/gedit /usr/share/man/man1/gedit.1.gz

where the /bin/ path is where the executable file is, the /share/ one is a folder containing some accessory file to the application and the /man/ one is the manual of gedit.

I hope this answers your question

Byte Commander
  • 105,631
  • 46
  • 284
  • 425
Matteo S.
  • 722
  • 1
  • 5
  • 16
  • 2
    This tells you the location of `gedit` files that you could access from the terminal, but it does not tell you what command would be run by a Launcher item. – Byte Commander Jul 31 '16 at 12:47
  • 1
    Hi, as far as I understand, the question was about the path where the application is located in the system. xamiro did not mentioned he wanted to know the command used to run the program. – Matteo S. Jul 31 '16 at 12:53