I have installed some apps through the Ubuntu Software center. How can I find the corresponding terminal command? For many apps, this is not the same as the displayed name. For example, the app called Text Editor can also be launched by typing "gedit" in the terminal, but how can I find this for other apps?
apropos will be of help.
apropos 'text editor' gives me
ed (1) - line-oriented text editor ex (1) - Vi IMproved, a programmer's text editor gedit (1) - text editor for the GNOME Desktop gnome-text-editor (1) - text editor for the GNOME Desktop red (1) - line-oriented text editor rview (1) - Vi IMproved, a programmer's text editor rvim (1) - Vi IMproved, a programmer's text editor vi (1) - Vi IMproved, a programmer's text editor view (1) - Vi IMproved, a programmer's text editor vim (1) - Vi IMproved, a programmer's text editor xedit (1) - simple text editor for X
You can navigate the directory
/usr/share/applications/, you will find the shortcuts of many applications, the files
cat those files and search for the entry
ls -l /usr/share/applications | grep thunderbird thunderbird.desktop cat thunderbird.desktop | grep Exec Exec=/usr/bin/thunderbird %u
In your example, you could type
/usr/bin/thunderbird is the command.
You can also try, as @pLumo suggest, search for keywords:
grep -ri "GenericaName=*text*\|Name=*text*" org.gnome.gedit.desktop:Name=Text Editor vim.desktop:GenericName=Text Editor
but is trickier because you have to guess what could be the the keywords.
If you know the name of the application as displayed on its window or on its icon, then the following command will show you the path(s) of the executable that "starts" that application:
grep -i "^ *Exec=" $(grep -ril "^ *Name=.*firefox" \ /usr/share/applications $HOME/.local/share/applications) /dev/null
Here firefox is the (partial) application name. In your case, assuming you are searching for the command line of the application called (exactly) Text Editor, then use this:
grep -i "^ *Exec=" $(grep -ril "^ *Name=Text Editor" \ /usr/share/applications $HOME/.local/share/applications) /dev/null
For more detailed information, you can inspect the contents of the
.desktop file(s) displayed in the
If you had already started the application and it is running on its own window, then enter the following command in a terminal:
ps --no-headers -p $(xprop _NET_WM_PID | cut -f2 -d=) -o cmd
and after that, click on the window you want to learn the command it was started.
This will show the command line (together with any command-line parameters) of the process displaying that window, which may not be necessarily the same as the command that was executed when you initially clicked on the icon to start the application that displayed that window.