Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

Thank you

share|improve this question
    
/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. –  Danatela Jul 15 '13 at 7:22
add comment

2 Answers

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

which indicator-monitor

Check out the env path run the following command echo $PATH

printed directories are accessible from anywhere.

share|improve this answer
1  
Basically the same answer as mine, but better structured. :) –  gertvdijk Jul 15 '13 at 7:07
add comment

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!).

share|improve this answer
    
but the file exists I can see it in /usr/share/applications, I will have to run this in a few hours when i get to my pc. Thnx tho –  drakoumelitos Jul 15 '13 at 6:54
    
@drakoumelitos No. There's only indicator-monitor.desktop in there, not indicator-monitor. –  gertvdijk Jul 15 '13 at 6:55
    
so within the .desktop there will be the command needed to execute it through the terminal? –  drakoumelitos Jul 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. –  gertvdijk Jul 15 '13 at 6:58
    
aha! ok then thnx a lot i guess my problem was finding the actual name of the app –  drakoumelitos Jul 15 '13 at 7:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.