Is it possible by application icon in Ubuntu (Applications or Dock) find run-path or run-command of this application?
For example, some apps is portable and was added manually, not from Ubuntu Software store.
Is it possible by application icon in Ubuntu (Applications or Dock) find run-path or run-command of this application?
For example, some apps is portable and was added manually, not from Ubuntu Software store.
Short answer
The information you are looking for is available in the .desktop file of the application.
Name=
lineExec=
line.Long answer and background
Each icon in the Applications menu of Gnome Shell corresponds with a .desktop file on disk. The .desktop file is an ordinary text file with the .desktop extension. This file provides information to the desktop environment on how to run the program, what icon to use, etc.
On the line that starts with
Exec=
, the executable is stated. The executable is the file that is run to start the program. Usually, the full pathname of the executable will be specified, providing you directly with the information you are looking for. If the full pathname is not specified, then the executable must be an application that is in your search path. Otherwise, the .desktop file will not work, i.e., clicking its icon in the Applications menu will not launch the program.To know the full path of an executable, of which you only know the file name, use the
which
command. For example,will inform you where the executable resides on your file system.
Last but not least, you need to locate the .desktop files in order to be able to find the path information that you are looking for. .desktop files commonly live in one of two places. System wide .desktop files live under /usr/share/applications. .desktop files to which only the current user has access, live under ~/.local/share/applications. For desktop files with the same name, the one in the local user's directory will have priority and appear in the Application menu.
.desktop files of programs installed through the snap package system will live in a different place. You can list all .desktop files on your system with the command
To see them page by page, you can use the
less
command.It may sometimes not immediately be obvious which icon in the Application menu belongs to which desktop menu. The Application menu displays the name of the application provided on the
Name=
line in the desktop file. With some bash wizardry, you could search that name within all the .desktop files to locate the ones containing the name. For example, this is a simple way on how to identify the .desktop file for the card game "AisleRiot Solitaire", knowing Gnome Shell displaye AisleRiot Soli..