This question already has an answer here:

I want to create a file which contains some commands (suppose 4 commands) such that when I click on that file, the commands will executed in terminal. Is it possible ? I am using Ubuntu 14.04 LTS. Thanks in advance !

marked as duplicate by Jacob Vlijm, Arronical, Eric Carvalho, muru command-line May 28 '16 at 8:55

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.


you must create a file using your favourite text editor in the following fashion

your commands here

The first line (I believe it is called magic line) ensures that the following commands are executed in the shell. After creating this file you have to give it executable permission: right click on file -> properties -> permissions -> tick the checkbox at the bottom. Now by double-clicking your commands should be executed. Please note that for commands containing 'sudo', additional work is required

  • Replace 'magic line' with 'shebang'. – Videonauth May 25 '16 at 22:06

Yes, it is possible. Make two files, let's call the first one main.sh and the second one sub.sh.

In main.sh put the following lines:

gnome-terminal -x "./sub.sh"

In sub.sh put the code you want to execute.

Be sure to make both files executable. Then double-click main.sh.

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