0

I want to have icon on desktop of my script so that whenever I click that icon my script runs.

1
  • Shouldn't you just be able to save the script on your desktop and make it executable? – cutrightjm Sep 11 '16 at 5:41
0

In terminal: ln -s /folder/of/the/script/script /home/yourusername/Desktop/linkname.desktop

ln is used to create link to files:

  • the -s switch tells the command to create a symbolic link, which means something very similar to MS windows shortcuts.

  • The first field is for full path of the target destination (in your case the script you wish to run clicking the icon on your desktop)

  • The second field is for the the path of the link you are creating, which in your case must be in desktop folder under your homedir.

A couple of final notes:

  1. Depending on your localization, your desktop folder may vary, in my case for example is under /home/username/Scrivania/ (i'm from Italy)
  2. The .desktop appendix in destination filename is needed to make destination file appear on desktop, given that you are using Unity as desktop manager (the default DM in latest ubuntu distros). Check that fits your DM also and amend as needed.
2
  • Thx funkoolow for Urs awesome explanation . I never thought that way to Create a soft link.i m using rhel 6 so I think destination file don't require .desktop extension Becoz it work without that . And one more one thing i have learnt about soft link in target part I have to give full path even I m inside that directory.once again thx funkoolow for Urs very nice explanation . – Deepak Sep 11 '16 at 8:02
  • Glad to help you out, even if the question was marked as a duplicate. Can you please mark my reply as answer to the question? I'm trying to understand how this network works. Thank you. – funkoolow Sep 16 '16 at 22:07

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