Run shell script from Desktop Ubuntu 19.04

6,011

Solution 1

Shell scripts on desktop don't run for me on Ubuntu 19.04, too. Fortunately, I found a workaround - right-click on the desktop, select "New Folder" to create a new folder and move all scripts from the desktop to this folder. They will run fine when double-clicked from this folder.

Solution 2

I had the same issue, but it varied. first I have my scripts in a "scripts" folder on the desktop. They would not run from a folder on the desktop. I "moved" them to the desktop, then they executed fine. When I move them back to the scripts folder on the desktop, they would just open in the text editor when clicking on them to run them. GreenFox's answer IS correct and worked for me. You need to change the behavior globally of how text files are handled. There is an option in the behavior area to say to either run them or open them.

in Ubuntu 19.04 you open the file manager (Nautilus) then click the horizontal lines (aka hamburger menu, aka select list), then click PREFERENCES, then click the Behavior tab and change the "executable text files" action from the default of "Display Them" to "Run Them".

Solution 3

I'm using PopOS, but it's all gnome3 so it should be the same.

Click the dots in upper right on a nautilus window (file explorer).

Then go to "Behavior" tab and the "Executable Text Files: Run Them" option is here.

It's worth noting this is off by default as a security feature. It's easy enough to right click, open terminal and run it from the command line if you know what your doing. If this computer isn't exclusively used be people who know what they're doing, best keep it off.

Share:
6,011

Related videos on Youtube

Paolo
Author by

Paolo

Updated on September 18, 2022

Comments

  • Paolo
    Paolo over 1 year

    I have several shell scripts located on the Desktop. Since the upgrade to 19.04 these no longer function.

    • "Allow executing file as program" is checked in the file properties;
    • With the dconf editor, org.gnome.nautilus.preferences.executable-text-activation is set to 'ask'.

    But still no effect. Please, what do I need to do to run a shell script without needing first to open the terminal and type it out?

  • Paolo
    Paolo about 5 years
    Thanks, this also works for me and is what I shall use too. It is really counter-intuitive that you can now run scripts from an ordinary folder but not from the desktop!
  • Paolo
    Paolo about 5 years
    As explained in the original question, this does not work for Ubuntu 19.04
  • GreenFox
    GreenFox about 5 years
    It worked for me. It isn't popping up a window though, it's just running in the background. Is that the issue?
  • jplandrain
    jplandrain almost 4 years
    It works for me on Ubuntu 20.04. There is even an option that pops up a dialog to ask you what to do (execute or open the file in an editor). I don't know why that isn't the default behavior, safe and foolproof.