Ubuntu: What command does Unity use to launch a program [duplicate]



Question:

This question already has an answer here:

For work I need to use the IBM Lotus Notes e-mail client. I have installed it without much problem, but I'm having troubles in launching it when I start the pc. The problem is that I can't find how I can launch the client from the terminal, so I can't put it in the startup list.

As of right now, I start the client by searching in my Unity for 'Notes' and this brings up the client and I just press enter to start running it. Is there a way I can figure out which command Unity uses to start the client so I can add it to the startup list?


Solution:1

In /usr/share/applications there will be a .desktop file for the app. This may not have the most obvious name, but you will be able to figure it out by trial and error...

Open the .desktop file and look for the first line that starts with

Exec=  

After = is the command the launcher uses to start the program, so you can use it in a terminal.

You may be able to simplify the command, for example, if it is a path, but the application is in your path, you can type only the name of the application. Or, your system might even have a shortcut to it.

Examples

In libreoffice-calc.desktop I find the line

Exec=libreoffice --calc  

Typing libreoffice --calc launches libreoffice calc

In python2.7.desktop I find

Exec=/usr/bin/python2.7  

But I can launch it with only python because:

$ file $(which python)  /usr/bin/python: symbolic link to python2.7  

In the file telegram.desktop I find

Exec=/opt/telegram/Telegram  

But I can launch it only with Telegram because I have added /opt/telegram to my path:

$ echo $PATH  /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/telegram:/opt/lks-indicator:/snap/bin  

(See how to add directories to your path here)


Solution:2

Is there a way I can figure out which command Unity uses to start the client so I can add it to the startup list?

Yes, the command is inside a .desktop file. See /usr/share/applications/ for a lot of them. It probably will be named notes.desktop.

Do a

sudo updatedb  locate notes.desktop  

or if that shows nothing use

locate *.desktop | more  

and scan for a possible desktop file that looks like notes.

Then do a more notes.desktop and look for the executable (Exec=).


But I would have guessed that the command is actually notes first. The dash will show you the actual command name.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »