Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im trying to make a shortcut to login my ssh server:

ssh x.x.x.x

I made the following file:

Made it executable:

sudo chmod +x ./ssh_home

Checked by right clicking properties to check if it was executable and it was..

But whatever I do, when double clicking it, it will launch gedit. I tried "Open With" but no terminal app is shown there. I searched the net but only found a way to link to the file while not integrating it in one "shortcut file"

share|improve this question
Did you add #! /usr/bin/sh at the beginning of the file (the first line)? – Misery May 23 '13 at 11:50
Out of interest, what version of Ubuntu are you running? In principle it should be just a case of marking the file as executable in Properties/Permissions, but on 13.04 this seems not to work for me (even directly on the .sh file, with #! /bin/bash at the start...) – Jez W May 23 '13 at 11:59
Also check owner and permissions. Does user clicking it have permission to run it? – Misery May 23 '13 at 12:04
Your commands can't be correct - You're referring to and /ssh_home, which are not the same files. – l0b0 May 23 '13 at 12:04
@Misery: It's /bin/sh, not /usr/bin/sh. (/usr/bin/sh will happen to work on systems where /bin and /usr/bin are the same directory; I don't think that's the case for Ubuntu>) – Keith Thompson Jul 10 '15 at 21:05
up vote -12 down vote accepted

open a terminal

sh '/home/yourname/Desktop/yourfile'   

or drag and drop it...

share|improve this answer
The question is to get a launcher set up on teh desktop... I dont think the terminal command would help on that front. – charlie May 23 '13 at 12:21
how on earth an answer with -6 downvotes is accepted as THE answer ? – Serg Feb 18 '15 at 17:47
@aaaa How does this help make a shell script into a launchabl desktop shortcut?? – Igor G. Mar 29 '15 at 16:26

I know this is a while ago but though if someone else asks I have this answer.
Open nautilus
Files menu -> behaviour tab
run executable text files when they are opened

In later versions this option is found at: Files menu -> Edit -> Preferences -> behaviour tab

In Ubuntu 14.10 move the mouse to the top of the screen and the File, Edit etc... Menu bar appears. Click EDIT -> Preferences -> Behaviour tab

share|improve this answer
Works perfectly, thank you. – denysonique Oct 2 '13 at 2:57
This should be the accepted answer IMHO. I was getting rather frustrated trying to figure out why I could not run the shell script from Nautilus. – David Baucum Aug 16 '14 at 0:12
What is Files menu? Never seen it. – Igor G. Mar 29 '15 at 16:27
Worked. Right click on my shell script in the file browser. Created link. Then drag and dropped link to desktop. Also did the step above in file browse -> Preferences->run instead of view. – maxweber Apr 16 '15 at 15:33
One complication is that this affects all executable files. (That might be what you want.) – Keith Thompson Jul 10 '15 at 21:06

I think it would be better to use a launcher file for your script by creating a ~/Desktop/ssh_home.desktop file with the following contents:

[Desktop Entry]  
Name=SSH Server  
GenericName=SSH Server  
Comment=Connect to My Server  

That way you will have an icon to click which will launch your script.

You may have to set the executable flag:

chmod +x ~/Desktop/ssh_home.desktop
share|improve this answer
This method IS working but I prefer a 1 file solution... – michel May 23 '13 at 14:16
@michel If all the script does is run ssh host, you don't need the script, just change the Exec line to Exec=ssh host. – geirha May 23 '13 at 18:33
This is the only solution that worked for me. – Aviad P. Aug 26 '15 at 16:50

The "trap" for me was that I searched via right-clicking on the file for a way to change the behaviour (to have a script run instead of opened in gedit). Don't right-click ! Rather open from the "regular" menu-bar:

Edit-Preferences-Behaviour and change to "run" or "ask each time".

Comment: For my taste there should be a way to run a program via right-clicking too. Especially since right-clicking leads to the menu "open with", which makes you search for "open with bash", however "bash" is not included as an option...

share|improve this answer

imo the simplest answer is -

  1. Check that the .sh file works if clicked or run from its own directory.
  2. If it works there, right-click on it in Files aka Nautilus, select 'Make Link'
  3. This produces a file named 'link to' in the same directory
  4. Drag this onto the desktop
  5. Rename it how you wish eg clean off 'link to' and 'sh', just leave the name, it will still work.
share|improve this answer

Your Answer


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.