DEV Community

Stack All Flow
Stack All Flow

Posted on • Originally published at stackallflow.com on

How to run .sh scripts in Ubuntu?

bashcommand lineexecute-commandscripts

Whenever I open a .sh file, it opens it in gedit instead of the terminal. I can’t find any option similar to Right ClickOpen WithOther Application…Terminal.

How do I open this file in the terminal?

Accepted Answer

Give execute permission to your script:

chmod +x /path/to/yourscript.sh

Enter fullscreen mode Exit fullscreen mode

And to run your script:

/path/to/yourscript.sh

Enter fullscreen mode Exit fullscreen mode

Since . refers to the current directory: if yourscript.sh is in the current directory, you can simplify this to:

./yourscript.sh

Enter fullscreen mode Exit fullscreen mode

The post How to run .sh scripts in Ubuntu? appeared first on Stack All Flow.

Top comments (0)