I want to use some applications shown on the Unity Launcher in a terminal, but I need to know the appropriate command to run them. How can I achieve that?
8 Answers
Most default applications will have a .desktop file located in /usr/share/applications.
To find out about the corresponding terminal command that will be run when launching one of these applications open the file browser Nautilus and right click on the application's icon to select Properties in the context menu. This will give you all details you need (shown here for System Settings that will run gnome-control-center -overview)

- 427
- 144,580
If you installed the application through the repositories or through dpkg, you can use this command:
dpkg -l | grep "application name"
This will search through all your installed applications, as well as search their descriptions; searching the description is the important part here, because the description usually contains the name of the application, even if the "command" to run it does not contain the application name.
Example:
In GNOME, there's an application called the Disk Usage Analyzer. However, the command to run it from the terminal is not disk-usage-analyzer. To find out its command, you can run:
dpkg -l | grep "disk usage"
The output should contain this entry:
alaa@aa-lu:~$ dpkg -l | grep "disk usage"
ii baobab 3.6.4-0ubuntu1 i386 GNOME disk usage analyzer
Look at the second column. The command to actually run the Disk Usage Analyzer is baobab.
What you can do is use xprop: it will let you click on a application and display information. To get the name, enter in a terminal:
xprop | grep WM_CLASS
if WM_CLASS doesn't work, then try with WM_COMMAND.
- 207,228
- 959
First, open Synaptic by running synaptic in the terminal. Type the name of the app in the quick filter box. For an example, I'll use LibreOffice Writer. Type the name of the app in the Synaptic filter: 
It appears as the first installed result (little green box), with the full package name libreoffice-writer in the first column.
Now, try running libreoffice-writer in the terminal. Sometimes the package will run, but in this case it doesn't work: 
Now, if you look back at Synaptic, you will see that the very first result is the libreoffice package. You could just run libreoffice in the terminal, in which case you get this window: 
Or, you could type man libreoffice in the terminal. If you look at the these two screenshots:

You can see that to directly launch LibreOffice Writer, you can use one of two commands: lowriter or libreoffice --writer. Both work equally well.
- 811
Some programs or applications simply run by a binary. By name of application one can find out where binary is located.
whereis name-of-application
ergo little example:
$ whereis gparted
gparted: /usr/sbin/gparted /usr/share/man/man8/gparted.8.gz
You simply can take over /usr/sbin/gparted - for to run this application gparted in entry of icon or application-name (like in cairo-dock). (in this case to run gparted root-password is necessary).
- 207,228
- 3,863
That is too simple for Linux geeks.
Close the application if it is open.
Open the application by clicking its icon.
For example, I click the icon Document Viewer.
Open Terminal (ctl alt T), and run
ps -u `whoami`|tail -3
The answer is on the first line of ouput:
mac2011-linux% ps -u `whoami`|tail -3
51252 ? 00:00:01 evince
53209 pts/3 00:00:00 ps
53211 pts/3 00:00:00 tail
Yes, Document Viewer is evince, not easy to guess.
- 596
xprop allows finding the PID of a running window, while ps allows finding command corresponding to a PID. By combining the two together, we can find a command corresponding to a window , like so :
ps --no-headers -p $(xprop | awk -F '=' '/_NET_WM_PID/{print $2}') -o cmd
xprop will turn your cursor into X , which you can use to click on a window, it will return the PID, and then ps will use that PID to print the command
- 107,582
From https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html:
Basically when you install an app, a .desktop file is generated somewhere. This .desktop file is what tells the desktop environment which command to run. There are many .desktop files scattered around the file system. Their locations are specified by the $XDG_DATA_DIRS environment variable, although most of them are in a subdirectory called "applications" in the paths specified in $XDG_DATA_DIRS. So you basically have to go through all of those files, check one by one the name of the app specified in them, and once you finally find the one with the name of your app you check the "Exec" key in them.
This super long command does that automatically for you. Just make sure to specify the name of the program to search for at the beginning and then run it in a terminal (PS: You can open a terminal with Ctrl+Shift+T).
NameOfProgramToSearchFor='CopyQ' && \
find $(tr ':' ' ' <<<"$XDG_DATA_DIRS") \
-name '*.desktop' \
-exec grep -e '^Name=' -e '^Exec=' {} \; 2>/dev/null |
grep -i -A 1 "^Name=.*$NameOfProgramToSearchFor.*$"
Or you can just do what @Takkat said. In my case his solution didn't work because I couldn't find the "Properties" button in the right click menu, since I am using Zorin OS and it doesn't show that option. Zorin OS is based on Ubuntu, so I can't really tell if this is just a Zorin OS thing or it's that @Takkat used an older version of Ubuntu.
- 288
- 3
- 10