How to execute a script just by double clicking like .EXE files in Windows?











up vote
101
down vote

favorite
37












How can I make a bash script executable by double clicking just like .exe files in Windows? I tried creating a launcher and assigning the script to it, but there are two consequences:




  1. the terminal twinkles, disappears, and nothing is done.

  2. you must specify to run in terminal in order to work.


I have a script that installs tomcat on an offline PC, including all dependencies of tomcat in the script. I need to make the script work on double clicking like windows since most who use the script will not be familiar with Ubuntu.



Forget the above explanation. I want to make a script that can be run by double-clicking on it, without using the terminal. Anybody knows how?










share|improve this question
























  • I think you may just be writing your desktop file poorly. Can you post (verbatim) the .desktop launcher that you wrote?
    – Jjed
    May 18 '12 at 15:25










  • Also, have you seen this? askubuntu.com/q/34597/24694
    – Jjed
    May 18 '12 at 15:27










  • Its just a launcher where you assign name and command to do its not that big idea
    – user61928
    May 19 '12 at 6:38










  • Also note, that scripts in linux are not called bash but shell afaik.
    – cauon
    Oct 5 '12 at 8:58






  • 3




    muru tipped me off to this, worked for me: askubuntu.com/questions/286621/…
    – draoi
    Nov 16 '15 at 23:56















up vote
101
down vote

favorite
37












How can I make a bash script executable by double clicking just like .exe files in Windows? I tried creating a launcher and assigning the script to it, but there are two consequences:




  1. the terminal twinkles, disappears, and nothing is done.

  2. you must specify to run in terminal in order to work.


I have a script that installs tomcat on an offline PC, including all dependencies of tomcat in the script. I need to make the script work on double clicking like windows since most who use the script will not be familiar with Ubuntu.



Forget the above explanation. I want to make a script that can be run by double-clicking on it, without using the terminal. Anybody knows how?










share|improve this question
























  • I think you may just be writing your desktop file poorly. Can you post (verbatim) the .desktop launcher that you wrote?
    – Jjed
    May 18 '12 at 15:25










  • Also, have you seen this? askubuntu.com/q/34597/24694
    – Jjed
    May 18 '12 at 15:27










  • Its just a launcher where you assign name and command to do its not that big idea
    – user61928
    May 19 '12 at 6:38










  • Also note, that scripts in linux are not called bash but shell afaik.
    – cauon
    Oct 5 '12 at 8:58






  • 3




    muru tipped me off to this, worked for me: askubuntu.com/questions/286621/…
    – draoi
    Nov 16 '15 at 23:56













up vote
101
down vote

favorite
37









up vote
101
down vote

favorite
37






37





How can I make a bash script executable by double clicking just like .exe files in Windows? I tried creating a launcher and assigning the script to it, but there are two consequences:




  1. the terminal twinkles, disappears, and nothing is done.

  2. you must specify to run in terminal in order to work.


I have a script that installs tomcat on an offline PC, including all dependencies of tomcat in the script. I need to make the script work on double clicking like windows since most who use the script will not be familiar with Ubuntu.



Forget the above explanation. I want to make a script that can be run by double-clicking on it, without using the terminal. Anybody knows how?










share|improve this question















How can I make a bash script executable by double clicking just like .exe files in Windows? I tried creating a launcher and assigning the script to it, but there are two consequences:




  1. the terminal twinkles, disappears, and nothing is done.

  2. you must specify to run in terminal in order to work.


I have a script that installs tomcat on an offline PC, including all dependencies of tomcat in the script. I need to make the script work on double clicking like windows since most who use the script will not be familiar with Ubuntu.



Forget the above explanation. I want to make a script that can be run by double-clicking on it, without using the terminal. Anybody knows how?







launcher scripts executable






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 13 '17 at 12:23









Community

1




1










asked May 18 '12 at 12:37







user61928



















  • I think you may just be writing your desktop file poorly. Can you post (verbatim) the .desktop launcher that you wrote?
    – Jjed
    May 18 '12 at 15:25










  • Also, have you seen this? askubuntu.com/q/34597/24694
    – Jjed
    May 18 '12 at 15:27










  • Its just a launcher where you assign name and command to do its not that big idea
    – user61928
    May 19 '12 at 6:38










  • Also note, that scripts in linux are not called bash but shell afaik.
    – cauon
    Oct 5 '12 at 8:58






  • 3




    muru tipped me off to this, worked for me: askubuntu.com/questions/286621/…
    – draoi
    Nov 16 '15 at 23:56


















  • I think you may just be writing your desktop file poorly. Can you post (verbatim) the .desktop launcher that you wrote?
    – Jjed
    May 18 '12 at 15:25










  • Also, have you seen this? askubuntu.com/q/34597/24694
    – Jjed
    May 18 '12 at 15:27










  • Its just a launcher where you assign name and command to do its not that big idea
    – user61928
    May 19 '12 at 6:38










  • Also note, that scripts in linux are not called bash but shell afaik.
    – cauon
    Oct 5 '12 at 8:58






  • 3




    muru tipped me off to this, worked for me: askubuntu.com/questions/286621/…
    – draoi
    Nov 16 '15 at 23:56
















I think you may just be writing your desktop file poorly. Can you post (verbatim) the .desktop launcher that you wrote?
– Jjed
May 18 '12 at 15:25




I think you may just be writing your desktop file poorly. Can you post (verbatim) the .desktop launcher that you wrote?
– Jjed
May 18 '12 at 15:25












Also, have you seen this? askubuntu.com/q/34597/24694
– Jjed
May 18 '12 at 15:27




Also, have you seen this? askubuntu.com/q/34597/24694
– Jjed
May 18 '12 at 15:27












Its just a launcher where you assign name and command to do its not that big idea
– user61928
May 19 '12 at 6:38




Its just a launcher where you assign name and command to do its not that big idea
– user61928
May 19 '12 at 6:38












Also note, that scripts in linux are not called bash but shell afaik.
– cauon
Oct 5 '12 at 8:58




Also note, that scripts in linux are not called bash but shell afaik.
– cauon
Oct 5 '12 at 8:58




3




3




muru tipped me off to this, worked for me: askubuntu.com/questions/286621/…
– draoi
Nov 16 '15 at 23:56




muru tipped me off to this, worked for me: askubuntu.com/questions/286621/…
– draoi
Nov 16 '15 at 23:56










9 Answers
9






active

oldest

votes

















up vote
118
down vote













I tested this and it worked fine. Ensure your script begins with the correct hash-bang, e.g. #!/bin/bash



Then follow these steps:



Hit Alt+F2, type dconf-editor and hit Enter.



In dconfg-editor goto: org ➤ gnome ➤ nautilus ➤ preferences



Click on executable-text-activation and from drop down menu select:



launch: to launch scripts as programs.



OR



ask: to ask what to do via a dialog.



Close dconf-editor. Thats it!



Source: How do I run executable scripts in Nautilus?
Answer courtesy of Basharat Sial.





Update
You also need to change permission of file. Right click and set "Allow executing file as program"






share|improve this answer























  • This worked great. Just a note, the "drop down menu" is reached by clicking on the value listed to the right of executable-text-activation (default value is display).
    – ryanjdillon
    Aug 14 '13 at 10:50






  • 3




    for those who cannot call the app, you need to install it first with sudo apt-get install dconf-editor
    – whale_steward
    Mar 14 '15 at 6:35






  • 1




    This works everywhere except on the Desktop. How can I make it work on the Desktop as well? I'm using Xubuntu 14.10.
    – shrx
    Mar 28 '15 at 17:17










  • Is there a way to do this in LXDE (for Lubuntu)?
    – childofsoong
    May 2 '15 at 20:05










  • This works great under slax unix to -- see slax.org for the really great Unix system you can boot off of a thumb drive.
    – raddevus
    Dec 5 '15 at 22:42


















up vote
66
down vote













On the newer versions, on nautilus (files), go to Edit > preferences > Behaviour tab > and change the settings for executable text file.






share|improve this answer

















  • 3




    Now 'Files -> Preferences'. (17.04)
    – niry
    Sep 27 '17 at 20:23










  • Sweet! The way to go imho.
    – codepleb
    Oct 12 '17 at 6:11










  • How to see output ?
    – Amr Lotfy
    Aug 29 at 1:00


















up vote
8
down vote













In Ubuntu and all Unix based OSes, afaik, nothing is set as executable by default. There are two ways of doing this.




  1. Right click on the script or file you want to execute. Go to Properties then to the Permissions Tab. Click the check box that says Execute.


  2. Open a Terminal cd into the directory where the file is found. Type chmod ugo+x filename. This will set the file to execute.



Now your users can double click to their hearts content.






share|improve this answer



















  • 2




    It still will ask you what to do with run in terminal or display or run ... So its not what i need
    – user61928
    May 19 '12 at 6:34










  • Only this answer worked on Gnome Ubuntu 17.04 for making desktop file executeable
    – Kunok
    Apr 14 '17 at 21:06




















up vote
3
down vote













I think creating a *.desktop file is missing here:



$ cat shortcut-for-my-script.desktop
[Desktop Entry]
Type=Application
Terminal=true
Name=Click-Script
Icon=utilities-terminal
Exec=gnome-terminal -e "bash -c './script.sh;$SHELL'"
Categories=Application;


If you create more than one *.desktop file for one script you are able to create multiple configurations by passing different parameters, which is a very comfortable and user-friendly way.






share|improve this answer




























    up vote
    3
    down vote













    If you're using XFce then you can make script executed in Thunar by executing this command:



    xfconf-query --channel thunar --property /misc-exec-shell-scripts-by-default 
    --create --type bool --set true


    or by using gui xfce4-settings-editor and creating the same property






    share|improve this answer






























      up vote
      1
      down vote













      You have to check 3 points :




      • Nautilus / Nemo configuration : https://askubuntu.com/a/286651/301025

      • The script file must be executable: https://askubuntu.com/a/275714/301025


      • The file system must allow execution :




        1. Type mount in a console

        2. Check if your file system has the noexec flag

        3. Remove the noexec flag by editing /etc/fstab and remount the modified system (eg. a reboot works)








      share|improve this answer






























        up vote
        0
        down vote













        When you create a launch in Desktop to a SHEL script or Whatever, in command line, don't forget to signal the script, to be executed in background.



        The script will die when he finished is job.






        share|improve this answer

















        • 1




          i did that but what prob is the terminal just twinkles and nothing happens
          – user61928
          May 19 '12 at 6:36


















        up vote
        0
        down vote













        Based on umask defualt value, you haven't execute permissions for files by default and must change mod to gain execute permissions, something like this:



        chmod u+x filename





        share|improve this answer

















        • 1




          Broth Ali sure i did it its obvious to do that
          – user61928
          May 19 '12 at 6:35


















        up vote
        -1
        down vote













        Specially for Android Studio You can follow my original answer here:



        To Create Desktop Launcher:




        • Click on Create Desktop Entry.. from Tools menu.


        enter image description here




        • It will be prompt for password, enter password of your current login.


        • Finally it will be display notification in Android Studio screen like:



        enter image description here




        • You can see in Applications => Programming => Android Studio, and you may see on desktop also after restarting system.


        Thank you. :)






        share|improve this answer























          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f138908%2fhow-to-execute-a-script-just-by-double-clicking-like-exe-files-in-windows%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown
























          9 Answers
          9






          active

          oldest

          votes








          9 Answers
          9






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          118
          down vote













          I tested this and it worked fine. Ensure your script begins with the correct hash-bang, e.g. #!/bin/bash



          Then follow these steps:



          Hit Alt+F2, type dconf-editor and hit Enter.



          In dconfg-editor goto: org ➤ gnome ➤ nautilus ➤ preferences



          Click on executable-text-activation and from drop down menu select:



          launch: to launch scripts as programs.



          OR



          ask: to ask what to do via a dialog.



          Close dconf-editor. Thats it!



          Source: How do I run executable scripts in Nautilus?
          Answer courtesy of Basharat Sial.





          Update
          You also need to change permission of file. Right click and set "Allow executing file as program"






          share|improve this answer























          • This worked great. Just a note, the "drop down menu" is reached by clicking on the value listed to the right of executable-text-activation (default value is display).
            – ryanjdillon
            Aug 14 '13 at 10:50






          • 3




            for those who cannot call the app, you need to install it first with sudo apt-get install dconf-editor
            – whale_steward
            Mar 14 '15 at 6:35






          • 1




            This works everywhere except on the Desktop. How can I make it work on the Desktop as well? I'm using Xubuntu 14.10.
            – shrx
            Mar 28 '15 at 17:17










          • Is there a way to do this in LXDE (for Lubuntu)?
            – childofsoong
            May 2 '15 at 20:05










          • This works great under slax unix to -- see slax.org for the really great Unix system you can boot off of a thumb drive.
            – raddevus
            Dec 5 '15 at 22:42















          up vote
          118
          down vote













          I tested this and it worked fine. Ensure your script begins with the correct hash-bang, e.g. #!/bin/bash



          Then follow these steps:



          Hit Alt+F2, type dconf-editor and hit Enter.



          In dconfg-editor goto: org ➤ gnome ➤ nautilus ➤ preferences



          Click on executable-text-activation and from drop down menu select:



          launch: to launch scripts as programs.



          OR



          ask: to ask what to do via a dialog.



          Close dconf-editor. Thats it!



          Source: How do I run executable scripts in Nautilus?
          Answer courtesy of Basharat Sial.





          Update
          You also need to change permission of file. Right click and set "Allow executing file as program"






          share|improve this answer























          • This worked great. Just a note, the "drop down menu" is reached by clicking on the value listed to the right of executable-text-activation (default value is display).
            – ryanjdillon
            Aug 14 '13 at 10:50






          • 3




            for those who cannot call the app, you need to install it first with sudo apt-get install dconf-editor
            – whale_steward
            Mar 14 '15 at 6:35






          • 1




            This works everywhere except on the Desktop. How can I make it work on the Desktop as well? I'm using Xubuntu 14.10.
            – shrx
            Mar 28 '15 at 17:17










          • Is there a way to do this in LXDE (for Lubuntu)?
            – childofsoong
            May 2 '15 at 20:05










          • This works great under slax unix to -- see slax.org for the really great Unix system you can boot off of a thumb drive.
            – raddevus
            Dec 5 '15 at 22:42













          up vote
          118
          down vote










          up vote
          118
          down vote









          I tested this and it worked fine. Ensure your script begins with the correct hash-bang, e.g. #!/bin/bash



          Then follow these steps:



          Hit Alt+F2, type dconf-editor and hit Enter.



          In dconfg-editor goto: org ➤ gnome ➤ nautilus ➤ preferences



          Click on executable-text-activation and from drop down menu select:



          launch: to launch scripts as programs.



          OR



          ask: to ask what to do via a dialog.



          Close dconf-editor. Thats it!



          Source: How do I run executable scripts in Nautilus?
          Answer courtesy of Basharat Sial.





          Update
          You also need to change permission of file. Right click and set "Allow executing file as program"






          share|improve this answer














          I tested this and it worked fine. Ensure your script begins with the correct hash-bang, e.g. #!/bin/bash



          Then follow these steps:



          Hit Alt+F2, type dconf-editor and hit Enter.



          In dconfg-editor goto: org ➤ gnome ➤ nautilus ➤ preferences



          Click on executable-text-activation and from drop down menu select:



          launch: to launch scripts as programs.



          OR



          ask: to ask what to do via a dialog.



          Close dconf-editor. Thats it!



          Source: How do I run executable scripts in Nautilus?
          Answer courtesy of Basharat Sial.





          Update
          You also need to change permission of file. Right click and set "Allow executing file as program"







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 27 at 12:18









          Vikramaditya Kukreja

          34




          34










          answered Jun 8 '13 at 20:23









          stevenmc

          1,304178




          1,304178












          • This worked great. Just a note, the "drop down menu" is reached by clicking on the value listed to the right of executable-text-activation (default value is display).
            – ryanjdillon
            Aug 14 '13 at 10:50






          • 3




            for those who cannot call the app, you need to install it first with sudo apt-get install dconf-editor
            – whale_steward
            Mar 14 '15 at 6:35






          • 1




            This works everywhere except on the Desktop. How can I make it work on the Desktop as well? I'm using Xubuntu 14.10.
            – shrx
            Mar 28 '15 at 17:17










          • Is there a way to do this in LXDE (for Lubuntu)?
            – childofsoong
            May 2 '15 at 20:05










          • This works great under slax unix to -- see slax.org for the really great Unix system you can boot off of a thumb drive.
            – raddevus
            Dec 5 '15 at 22:42


















          • This worked great. Just a note, the "drop down menu" is reached by clicking on the value listed to the right of executable-text-activation (default value is display).
            – ryanjdillon
            Aug 14 '13 at 10:50






          • 3




            for those who cannot call the app, you need to install it first with sudo apt-get install dconf-editor
            – whale_steward
            Mar 14 '15 at 6:35






          • 1




            This works everywhere except on the Desktop. How can I make it work on the Desktop as well? I'm using Xubuntu 14.10.
            – shrx
            Mar 28 '15 at 17:17










          • Is there a way to do this in LXDE (for Lubuntu)?
            – childofsoong
            May 2 '15 at 20:05










          • This works great under slax unix to -- see slax.org for the really great Unix system you can boot off of a thumb drive.
            – raddevus
            Dec 5 '15 at 22:42
















          This worked great. Just a note, the "drop down menu" is reached by clicking on the value listed to the right of executable-text-activation (default value is display).
          – ryanjdillon
          Aug 14 '13 at 10:50




          This worked great. Just a note, the "drop down menu" is reached by clicking on the value listed to the right of executable-text-activation (default value is display).
          – ryanjdillon
          Aug 14 '13 at 10:50




          3




          3




          for those who cannot call the app, you need to install it first with sudo apt-get install dconf-editor
          – whale_steward
          Mar 14 '15 at 6:35




          for those who cannot call the app, you need to install it first with sudo apt-get install dconf-editor
          – whale_steward
          Mar 14 '15 at 6:35




          1




          1




          This works everywhere except on the Desktop. How can I make it work on the Desktop as well? I'm using Xubuntu 14.10.
          – shrx
          Mar 28 '15 at 17:17




          This works everywhere except on the Desktop. How can I make it work on the Desktop as well? I'm using Xubuntu 14.10.
          – shrx
          Mar 28 '15 at 17:17












          Is there a way to do this in LXDE (for Lubuntu)?
          – childofsoong
          May 2 '15 at 20:05




          Is there a way to do this in LXDE (for Lubuntu)?
          – childofsoong
          May 2 '15 at 20:05












          This works great under slax unix to -- see slax.org for the really great Unix system you can boot off of a thumb drive.
          – raddevus
          Dec 5 '15 at 22:42




          This works great under slax unix to -- see slax.org for the really great Unix system you can boot off of a thumb drive.
          – raddevus
          Dec 5 '15 at 22:42












          up vote
          66
          down vote













          On the newer versions, on nautilus (files), go to Edit > preferences > Behaviour tab > and change the settings for executable text file.






          share|improve this answer

















          • 3




            Now 'Files -> Preferences'. (17.04)
            – niry
            Sep 27 '17 at 20:23










          • Sweet! The way to go imho.
            – codepleb
            Oct 12 '17 at 6:11










          • How to see output ?
            – Amr Lotfy
            Aug 29 at 1:00















          up vote
          66
          down vote













          On the newer versions, on nautilus (files), go to Edit > preferences > Behaviour tab > and change the settings for executable text file.






          share|improve this answer

















          • 3




            Now 'Files -> Preferences'. (17.04)
            – niry
            Sep 27 '17 at 20:23










          • Sweet! The way to go imho.
            – codepleb
            Oct 12 '17 at 6:11










          • How to see output ?
            – Amr Lotfy
            Aug 29 at 1:00













          up vote
          66
          down vote










          up vote
          66
          down vote









          On the newer versions, on nautilus (files), go to Edit > preferences > Behaviour tab > and change the settings for executable text file.






          share|improve this answer












          On the newer versions, on nautilus (files), go to Edit > preferences > Behaviour tab > and change the settings for executable text file.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 1 '14 at 23:33









          Anon

          66152




          66152








          • 3




            Now 'Files -> Preferences'. (17.04)
            – niry
            Sep 27 '17 at 20:23










          • Sweet! The way to go imho.
            – codepleb
            Oct 12 '17 at 6:11










          • How to see output ?
            – Amr Lotfy
            Aug 29 at 1:00














          • 3




            Now 'Files -> Preferences'. (17.04)
            – niry
            Sep 27 '17 at 20:23










          • Sweet! The way to go imho.
            – codepleb
            Oct 12 '17 at 6:11










          • How to see output ?
            – Amr Lotfy
            Aug 29 at 1:00








          3




          3




          Now 'Files -> Preferences'. (17.04)
          – niry
          Sep 27 '17 at 20:23




          Now 'Files -> Preferences'. (17.04)
          – niry
          Sep 27 '17 at 20:23












          Sweet! The way to go imho.
          – codepleb
          Oct 12 '17 at 6:11




          Sweet! The way to go imho.
          – codepleb
          Oct 12 '17 at 6:11












          How to see output ?
          – Amr Lotfy
          Aug 29 at 1:00




          How to see output ?
          – Amr Lotfy
          Aug 29 at 1:00










          up vote
          8
          down vote













          In Ubuntu and all Unix based OSes, afaik, nothing is set as executable by default. There are two ways of doing this.




          1. Right click on the script or file you want to execute. Go to Properties then to the Permissions Tab. Click the check box that says Execute.


          2. Open a Terminal cd into the directory where the file is found. Type chmod ugo+x filename. This will set the file to execute.



          Now your users can double click to their hearts content.






          share|improve this answer



















          • 2




            It still will ask you what to do with run in terminal or display or run ... So its not what i need
            – user61928
            May 19 '12 at 6:34










          • Only this answer worked on Gnome Ubuntu 17.04 for making desktop file executeable
            – Kunok
            Apr 14 '17 at 21:06

















          up vote
          8
          down vote













          In Ubuntu and all Unix based OSes, afaik, nothing is set as executable by default. There are two ways of doing this.




          1. Right click on the script or file you want to execute. Go to Properties then to the Permissions Tab. Click the check box that says Execute.


          2. Open a Terminal cd into the directory where the file is found. Type chmod ugo+x filename. This will set the file to execute.



          Now your users can double click to their hearts content.






          share|improve this answer



















          • 2




            It still will ask you what to do with run in terminal or display or run ... So its not what i need
            – user61928
            May 19 '12 at 6:34










          • Only this answer worked on Gnome Ubuntu 17.04 for making desktop file executeable
            – Kunok
            Apr 14 '17 at 21:06















          up vote
          8
          down vote










          up vote
          8
          down vote









          In Ubuntu and all Unix based OSes, afaik, nothing is set as executable by default. There are two ways of doing this.




          1. Right click on the script or file you want to execute. Go to Properties then to the Permissions Tab. Click the check box that says Execute.


          2. Open a Terminal cd into the directory where the file is found. Type chmod ugo+x filename. This will set the file to execute.



          Now your users can double click to their hearts content.






          share|improve this answer














          In Ubuntu and all Unix based OSes, afaik, nothing is set as executable by default. There are two ways of doing this.




          1. Right click on the script or file you want to execute. Go to Properties then to the Permissions Tab. Click the check box that says Execute.


          2. Open a Terminal cd into the directory where the file is found. Type chmod ugo+x filename. This will set the file to execute.



          Now your users can double click to their hearts content.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 18 '12 at 12:58









          Eliah Kagan

          81k20226364




          81k20226364










          answered May 18 '12 at 12:47









          SomKit

          30717




          30717








          • 2




            It still will ask you what to do with run in terminal or display or run ... So its not what i need
            – user61928
            May 19 '12 at 6:34










          • Only this answer worked on Gnome Ubuntu 17.04 for making desktop file executeable
            – Kunok
            Apr 14 '17 at 21:06
















          • 2




            It still will ask you what to do with run in terminal or display or run ... So its not what i need
            – user61928
            May 19 '12 at 6:34










          • Only this answer worked on Gnome Ubuntu 17.04 for making desktop file executeable
            – Kunok
            Apr 14 '17 at 21:06










          2




          2




          It still will ask you what to do with run in terminal or display or run ... So its not what i need
          – user61928
          May 19 '12 at 6:34




          It still will ask you what to do with run in terminal or display or run ... So its not what i need
          – user61928
          May 19 '12 at 6:34












          Only this answer worked on Gnome Ubuntu 17.04 for making desktop file executeable
          – Kunok
          Apr 14 '17 at 21:06






          Only this answer worked on Gnome Ubuntu 17.04 for making desktop file executeable
          – Kunok
          Apr 14 '17 at 21:06












          up vote
          3
          down vote













          I think creating a *.desktop file is missing here:



          $ cat shortcut-for-my-script.desktop
          [Desktop Entry]
          Type=Application
          Terminal=true
          Name=Click-Script
          Icon=utilities-terminal
          Exec=gnome-terminal -e "bash -c './script.sh;$SHELL'"
          Categories=Application;


          If you create more than one *.desktop file for one script you are able to create multiple configurations by passing different parameters, which is a very comfortable and user-friendly way.






          share|improve this answer

























            up vote
            3
            down vote













            I think creating a *.desktop file is missing here:



            $ cat shortcut-for-my-script.desktop
            [Desktop Entry]
            Type=Application
            Terminal=true
            Name=Click-Script
            Icon=utilities-terminal
            Exec=gnome-terminal -e "bash -c './script.sh;$SHELL'"
            Categories=Application;


            If you create more than one *.desktop file for one script you are able to create multiple configurations by passing different parameters, which is a very comfortable and user-friendly way.






            share|improve this answer























              up vote
              3
              down vote










              up vote
              3
              down vote









              I think creating a *.desktop file is missing here:



              $ cat shortcut-for-my-script.desktop
              [Desktop Entry]
              Type=Application
              Terminal=true
              Name=Click-Script
              Icon=utilities-terminal
              Exec=gnome-terminal -e "bash -c './script.sh;$SHELL'"
              Categories=Application;


              If you create more than one *.desktop file for one script you are able to create multiple configurations by passing different parameters, which is a very comfortable and user-friendly way.






              share|improve this answer












              I think creating a *.desktop file is missing here:



              $ cat shortcut-for-my-script.desktop
              [Desktop Entry]
              Type=Application
              Terminal=true
              Name=Click-Script
              Icon=utilities-terminal
              Exec=gnome-terminal -e "bash -c './script.sh;$SHELL'"
              Categories=Application;


              If you create more than one *.desktop file for one script you are able to create multiple configurations by passing different parameters, which is a very comfortable and user-friendly way.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Oct 2 '15 at 7:22









              h0ch5tr4355

              372516




              372516






















                  up vote
                  3
                  down vote













                  If you're using XFce then you can make script executed in Thunar by executing this command:



                  xfconf-query --channel thunar --property /misc-exec-shell-scripts-by-default 
                  --create --type bool --set true


                  or by using gui xfce4-settings-editor and creating the same property






                  share|improve this answer



























                    up vote
                    3
                    down vote













                    If you're using XFce then you can make script executed in Thunar by executing this command:



                    xfconf-query --channel thunar --property /misc-exec-shell-scripts-by-default 
                    --create --type bool --set true


                    or by using gui xfce4-settings-editor and creating the same property






                    share|improve this answer

























                      up vote
                      3
                      down vote










                      up vote
                      3
                      down vote









                      If you're using XFce then you can make script executed in Thunar by executing this command:



                      xfconf-query --channel thunar --property /misc-exec-shell-scripts-by-default 
                      --create --type bool --set true


                      or by using gui xfce4-settings-editor and creating the same property






                      share|improve this answer














                      If you're using XFce then you can make script executed in Thunar by executing this command:



                      xfconf-query --channel thunar --property /misc-exec-shell-scripts-by-default 
                      --create --type bool --set true


                      or by using gui xfce4-settings-editor and creating the same property







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Apr 18 '17 at 15:50

























                      answered Jan 14 '17 at 20:49









                      jcubic

                      45931021




                      45931021






















                          up vote
                          1
                          down vote













                          You have to check 3 points :




                          • Nautilus / Nemo configuration : https://askubuntu.com/a/286651/301025

                          • The script file must be executable: https://askubuntu.com/a/275714/301025


                          • The file system must allow execution :




                            1. Type mount in a console

                            2. Check if your file system has the noexec flag

                            3. Remove the noexec flag by editing /etc/fstab and remount the modified system (eg. a reboot works)








                          share|improve this answer



























                            up vote
                            1
                            down vote













                            You have to check 3 points :




                            • Nautilus / Nemo configuration : https://askubuntu.com/a/286651/301025

                            • The script file must be executable: https://askubuntu.com/a/275714/301025


                            • The file system must allow execution :




                              1. Type mount in a console

                              2. Check if your file system has the noexec flag

                              3. Remove the noexec flag by editing /etc/fstab and remount the modified system (eg. a reboot works)








                            share|improve this answer

























                              up vote
                              1
                              down vote










                              up vote
                              1
                              down vote









                              You have to check 3 points :




                              • Nautilus / Nemo configuration : https://askubuntu.com/a/286651/301025

                              • The script file must be executable: https://askubuntu.com/a/275714/301025


                              • The file system must allow execution :




                                1. Type mount in a console

                                2. Check if your file system has the noexec flag

                                3. Remove the noexec flag by editing /etc/fstab and remount the modified system (eg. a reboot works)








                              share|improve this answer














                              You have to check 3 points :




                              • Nautilus / Nemo configuration : https://askubuntu.com/a/286651/301025

                              • The script file must be executable: https://askubuntu.com/a/275714/301025


                              • The file system must allow execution :




                                1. Type mount in a console

                                2. Check if your file system has the noexec flag

                                3. Remove the noexec flag by editing /etc/fstab and remount the modified system (eg. a reboot works)









                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Apr 13 '17 at 12:25









                              Community

                              1




                              1










                              answered May 17 '15 at 10:14









                              sangorys

                              20625




                              20625






















                                  up vote
                                  0
                                  down vote













                                  When you create a launch in Desktop to a SHEL script or Whatever, in command line, don't forget to signal the script, to be executed in background.



                                  The script will die when he finished is job.






                                  share|improve this answer

















                                  • 1




                                    i did that but what prob is the terminal just twinkles and nothing happens
                                    – user61928
                                    May 19 '12 at 6:36















                                  up vote
                                  0
                                  down vote













                                  When you create a launch in Desktop to a SHEL script or Whatever, in command line, don't forget to signal the script, to be executed in background.



                                  The script will die when he finished is job.






                                  share|improve this answer

















                                  • 1




                                    i did that but what prob is the terminal just twinkles and nothing happens
                                    – user61928
                                    May 19 '12 at 6:36













                                  up vote
                                  0
                                  down vote










                                  up vote
                                  0
                                  down vote









                                  When you create a launch in Desktop to a SHEL script or Whatever, in command line, don't forget to signal the script, to be executed in background.



                                  The script will die when he finished is job.






                                  share|improve this answer












                                  When you create a launch in Desktop to a SHEL script or Whatever, in command line, don't forget to signal the script, to be executed in background.



                                  The script will die when he finished is job.







                                  share|improve this answer












                                  share|improve this answer



                                  share|improve this answer










                                  answered May 18 '12 at 12:42









                                  Octávio Filipe Gonçalves

                                  10.5k41422




                                  10.5k41422








                                  • 1




                                    i did that but what prob is the terminal just twinkles and nothing happens
                                    – user61928
                                    May 19 '12 at 6:36














                                  • 1




                                    i did that but what prob is the terminal just twinkles and nothing happens
                                    – user61928
                                    May 19 '12 at 6:36








                                  1




                                  1




                                  i did that but what prob is the terminal just twinkles and nothing happens
                                  – user61928
                                  May 19 '12 at 6:36




                                  i did that but what prob is the terminal just twinkles and nothing happens
                                  – user61928
                                  May 19 '12 at 6:36










                                  up vote
                                  0
                                  down vote













                                  Based on umask defualt value, you haven't execute permissions for files by default and must change mod to gain execute permissions, something like this:



                                  chmod u+x filename





                                  share|improve this answer

















                                  • 1




                                    Broth Ali sure i did it its obvious to do that
                                    – user61928
                                    May 19 '12 at 6:35















                                  up vote
                                  0
                                  down vote













                                  Based on umask defualt value, you haven't execute permissions for files by default and must change mod to gain execute permissions, something like this:



                                  chmod u+x filename





                                  share|improve this answer

















                                  • 1




                                    Broth Ali sure i did it its obvious to do that
                                    – user61928
                                    May 19 '12 at 6:35













                                  up vote
                                  0
                                  down vote










                                  up vote
                                  0
                                  down vote









                                  Based on umask defualt value, you haven't execute permissions for files by default and must change mod to gain execute permissions, something like this:



                                  chmod u+x filename





                                  share|improve this answer












                                  Based on umask defualt value, you haven't execute permissions for files by default and must change mod to gain execute permissions, something like this:



                                  chmod u+x filename






                                  share|improve this answer












                                  share|improve this answer



                                  share|improve this answer










                                  answered May 18 '12 at 14:13









                                  Ali Dehghani

                                  34649




                                  34649








                                  • 1




                                    Broth Ali sure i did it its obvious to do that
                                    – user61928
                                    May 19 '12 at 6:35














                                  • 1




                                    Broth Ali sure i did it its obvious to do that
                                    – user61928
                                    May 19 '12 at 6:35








                                  1




                                  1




                                  Broth Ali sure i did it its obvious to do that
                                  – user61928
                                  May 19 '12 at 6:35




                                  Broth Ali sure i did it its obvious to do that
                                  – user61928
                                  May 19 '12 at 6:35










                                  up vote
                                  -1
                                  down vote













                                  Specially for Android Studio You can follow my original answer here:



                                  To Create Desktop Launcher:




                                  • Click on Create Desktop Entry.. from Tools menu.


                                  enter image description here




                                  • It will be prompt for password, enter password of your current login.


                                  • Finally it will be display notification in Android Studio screen like:



                                  enter image description here




                                  • You can see in Applications => Programming => Android Studio, and you may see on desktop also after restarting system.


                                  Thank you. :)






                                  share|improve this answer



























                                    up vote
                                    -1
                                    down vote













                                    Specially for Android Studio You can follow my original answer here:



                                    To Create Desktop Launcher:




                                    • Click on Create Desktop Entry.. from Tools menu.


                                    enter image description here




                                    • It will be prompt for password, enter password of your current login.


                                    • Finally it will be display notification in Android Studio screen like:



                                    enter image description here




                                    • You can see in Applications => Programming => Android Studio, and you may see on desktop also after restarting system.


                                    Thank you. :)






                                    share|improve this answer

























                                      up vote
                                      -1
                                      down vote










                                      up vote
                                      -1
                                      down vote









                                      Specially for Android Studio You can follow my original answer here:



                                      To Create Desktop Launcher:




                                      • Click on Create Desktop Entry.. from Tools menu.


                                      enter image description here




                                      • It will be prompt for password, enter password of your current login.


                                      • Finally it will be display notification in Android Studio screen like:



                                      enter image description here




                                      • You can see in Applications => Programming => Android Studio, and you may see on desktop also after restarting system.


                                      Thank you. :)






                                      share|improve this answer














                                      Specially for Android Studio You can follow my original answer here:



                                      To Create Desktop Launcher:




                                      • Click on Create Desktop Entry.. from Tools menu.


                                      enter image description here




                                      • It will be prompt for password, enter password of your current login.


                                      • Finally it will be display notification in Android Studio screen like:



                                      enter image description here




                                      • You can see in Applications => Programming => Android Studio, and you may see on desktop also after restarting system.


                                      Thank you. :)







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited Apr 13 '17 at 12:23









                                      Community

                                      1




                                      1










                                      answered Feb 17 '16 at 6:46









                                      Pratik Butani

                                      130110




                                      130110






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Ask Ubuntu!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.





                                          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                          Please pay close attention to the following guidance:


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f138908%2fhow-to-execute-a-script-just-by-double-clicking-like-exe-files-in-windows%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          Ellipse (mathématiques)

                                          Quarter-circle Tiles

                                          Mont Emei