This question already has an answer here:

I am new to Ubuntu and I just started learning bash.
How can I open bash files through terminal?

marked as duplicate by Sylvain Pineau, Pandya, αғsнιη, Eric Carvalho, Radu Rădeanu Oct 2 '14 at 16:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


To edit:

Use any editor you like:

gedit some_file.sh
nano  some_file.sh
vim   some_file.sh
# ...

To run:

Either make it executable and run it giving the path:

chmod +x some_file.sh

Or tell bash to run it:

bash some_file.sh

Also see: How to run scripts without typing the full path?


Give it permission to run

chmod +x /path/to/yourscript.sh

And run your script:


Make it executable using

chmod +x filename 

and run it in terminal using



You simply

bash filename

To open a bash file for editing (something with an .sh suffix) you can use a text editor like nano.

nano filename.sh

If you want to run a bash script you can do it in several ways.



sh filename.sh

Best, Lev

Not the answer you're looking for? Browse other questions tagged or ask your own question.