I have the following app "System monitor indicator" and I want to make it start on boot up. So I am trying to find whats the name of the app to call it from the terminal, I find the "exe" at /usr/share/applications and the name is indicator-monitor.desktop

If I try

sudo /usr/share/applications/indicator-monitor

it says command not found

If I remove the sudo it says permission denied.

however when I do

cd /usr/share/applications && sudo indicator-monitor

it executes fine.

If I put the above on the start up command it doesn't open.
Any ideas?

/usr/share/applications is not the correct path for binary executables. And indicator-monitor is the command that is searched in directories set in $PATH environment variable. There are generally 6-8 locations divided by colon sign: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lo‌​cal/games.
–
DanatelaJul 15 '13 at 7:22

2 Answers
2

You are going wrong. /usr/share/applications contains launcher file(config file), not executable file. You can't run .desktop file by sudo command. Instead of you should run executable file.

sudo /usr/share/applications/indicator-monitor

Why it's not working? There is no file named indicator-monitor but indicator-monitor.desktop.

cd /usr/share/applications && sudo indicator-monitor

Why it's working? your first command will go to applications folder. It's ok. But next command will run indicator-monitor (executable file from env path), not from current directory. Current directory needs ./ prefix.

How to find where is executable file? run the following command with application name

You're not running anything in /usr/share/applications/. By cd'in into there doesn't make it run off there from a .desktop file. Instead, it just goes off your PATHs. You are just running the global indicator-monitor from a global PATH.

It doesn't make any difference as to what your current working directory is. Just

sudo indicator-monitor

in anywhere will result in the same.

And you see a "command not found" error because there's no such file like /usr/share/applications/indicator-monitor. Run

ln -s /usr/share/applications/indicator-monitor

to verify.

A .desktop file is meant to run from the GUI, being displayed as an icon and to be run by clicking it. See the contents of the file for what is actually happening (just a text file!).

so within the .desktop there will be the command needed to execute it through the terminal?
–
drakoumelitosJul 15 '13 at 6:58

@drakoumelitos Yes. It has a line starting with Exec= usually showing what command will be run in the background if you click an icon. However, this could take more parameters than you use on the command line specified by the .desktop file standard.
–
gertvdijkJul 15 '13 at 6:58

aha! ok then thnx a lot i guess my problem was finding the actual name of the app
–
drakoumelitosJul 15 '13 at 7:00