5

Whenever I download an .sh-file gedit opens up and then freezes. Why?

3
  • What is the script? Apr 20, 2015 at 12:55
  • Do you want to run the .sh file? Apr 20, 2015 at 16:48
  • I know how to run .sh files over the command line, I just wonder why gedit always opens up and freezes.
    – empedokles
    Apr 21, 2015 at 13:06

2 Answers 2

10

If gedit opens up after the download is complete, that's because your browser is set up to open downloaded files automatically and to open them in the system's default application.

If gedit opens up because you double-clicked on the .sh file in nautilus, that's because of the default behavior of nautilus, which is to open .sh files in the system's default text editor rather than to run them.

To change nautilus' default behavior:

  1. Open Files from the Unity Launcher
  2. On the Unity Panel, click on "Edit" > "Preferences"
  3. Select the "Behavior" tab and under "Executable Text Files" select "Run executable files when they are opened" and click on the "Close" button.

On why gedit freezes, it might be that the .sh file is very long.

If the .sh is not very long, it might be that it is encoded with some exotic encoding that gedit cannot handle.

If the .sh file is not encoded with any exotic encoding, try to reinstall / update gedit by running this command in a Terminal: sudo apt-get remove gedit && sudo apt-get update && sudo apt-get install gedit

1
  • 1
    Thanks! Wouldn't it be a lot more intuitive for us newbies if Ubuntu did run .sh files per default?
    – empedokles
    Apr 21, 2015 at 13:13
1

sh files aren't double-click executables; they need to be run from the terminal. (/path/to/script.sh) sh files can also be big. More than 10MB of text is sure to freeze up any text program for a while, until it can load all of the text.

6
  • 1
    sudo for a unknown script can be dangerous.
    – A.B.
    Apr 20, 2015 at 12:43
  • @A.B. OK, Mr. Critical. It's edited. Apr 20, 2015 at 15:52
  • Come on, gksudo is just as dangerous. It's about to run the script with superuser privileges without it to see before.
    – A.B.
    Apr 20, 2015 at 15:54
  • @A.B. What would you like? Apr 20, 2015 at 15:55
  • Let the sudo just gone.
    – A.B.
    Apr 20, 2015 at 15:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .