1

I have Ubuntu 14.0.4 LTS. I have the following folder on my system:

/opt/JBoss_4.0.4.GA/server/default/deploy

Also I have this symbolic link to that folder on my Desktop:

JBoss deploy -> /opt/JBoss_4.0.4.GA/server/default/deploy

When I double click on the link, nautilus opens a directory with this path:

/home/sasan/Desktop/JBoss deploy

But this is what I want:

/opt/JBoss_4.0.4.GA/server/default/deploy

Is there anyway to create a link that acts just like a shortcut? Or is there anyway to create actual shortcut in Linux?

S.Yavari
  • 113

2 Answers2

3

There is a standard for desktop entry which is specified in These pages. You can specify what action to take when you open (effectively click) that desktop item. The action can be bash commands.

Or in your case:
nautilus /opt/JBoss_4.0.4.GA/server/default/deploy

Just For the sake of completeness, here's an example: Chrome.desktop

[Desktop Entry]
Name=Google Chrome
Exec=google-chrome-stable
Type=Application
StartupNotify=true
Path=/usr/bin/
Icon=/home/bibek/.local/share/icons/hicolor/32x32/Google-Chrome-Google-Chrome.ico
Name[C]=Chrome

This is what the shortcut for chrome looks like in my Mint Desktop. That Exec line is what actually gets executed on click events, assuming the entry right after = is executable (arguments are separated by space).

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Bibek_G
  • 549
0

The FreeDesktop standard defines multiple kinds of desktop entries:

This specification defines 3 types of desktop entries: Application (type 1), Link (type 2) and Directory (type 3).

Using a type-1 (Application) desktop file is one option, but Link-type desktop files will also work for your purposes and is not tied to a particular file manager. For the example given, create a file on your desktop called deploy.desktop and insert these contents:

[Desktop Entry]
Name=Link to deploy
Type=Link
URL=file:///opt/JBoss_4.0.4.GA/server/default/deploy/
Icon=folder

It looks like this:

Link to deploy

and opens to this path in the default file manager:

/opt/JBoss_4.0.4.GA/server/default/deploy/

Note that if the path contained spaces or other special characters, it would need to be percent escaped to convert a path into a valid file:// URL. Some file managers can assist you if you encounter difficulty doing this by hand.

Related: