I have a .desktop file that contains these lines:

[Desktop Entry]
Comment=Client for Online Virtual Worlds, such as Second Life

I just re-installed Ubuntu 14.04 before the reinstall this file worked just fine. Now it doesn't. I did set the exec property.

When I run it from terminal I get this:

deus@xxx:~/DesktopShortcuts$ ./firestorm.desktop 
./firestorm.desktop: line 1: [Desktop: command not found
./firestorm.desktop: line 3: for: command not found
./firestorm.desktop: line 10: Network: command not found

Can anyone tell me what the problem is and how to fix it?

Thank you.

  • ... I don't want to run it by terminal... it doesn't run in nautilus.
    – Not Amused
    May 27 '14 at 20:13
  • OK, you didn't mention that. The only example usage I see is trying to run it from a terminal. Do the files that the .desktop is referencing exist? (/home/deus/Programs/Firestorm_64bit/firestorm, /home/deus/Programs/Firestorm_64bit/firestorm_icon.png). You could also try removing or commenting out the lines that start with TargetEnvironment= (I don't see this one here) and maybe StartupWMClass=.
    – Chuck R
    May 27 '14 at 20:23
  • Here is something else referring to how TargetEnvironment= is deprecated (and may, in fact, be removed from the source, which would break any .desktop files using it) and OnlyShowIn=Unity should be used instead: markmail.org/message/eypvnff4bieqf5bj
    – Chuck R
    May 27 '14 at 20:26
  • @Githlar... Since we're talking about .desktop files, it's only natural to run them through the desktop. The reason I tried command line was to see what was the error. And show it to this forum. I did the change you suggested but nothing changed. Also I mentioned that it worked before I re-install Ubuntu 14.04. The same file. I also checked the paths just in case, they are correct.
    – Not Amused
    May 27 '14 at 21:39
  • If you try to manually run the command that the .desktop launches, does it work? /home/deus/Programs/Firestorm_64bit/firestorm
    – Chuck R
    May 27 '14 at 23:07

You can't open a desktop shortcut as an script, because the shell won't understand the command and it'll just try to execute line by line what's in the text file.

Try this:

gnome-open firestorm.desktop

If it doesn't work, it may be a problem of permissions. Try to do the file executable with:

chmod +x firestorm.desktop

or trought the properties menu that appears if you right click on the desktop file.

  • 3
    I did what you said and it just opens the file as text file with gedit.
    – Not Amused
    May 27 '14 at 20:03
  • 1
    Try with nautilus after you give it execute permissions. May 27 '14 at 20:33
  • If you can see the icon of your program in Nautilus, darent's solution should work May 27 '14 at 20:36
  • 1
    Command 'gnome-open' not found. How does my Files application run the file without gnome-open?
    – Gqqnbig
    Feb 3 '19 at 4:22

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