Ubuntu – How to execute commands in a text file

command linescripts

I have a bunch of commands seperated by \ns that I'd like to execute serially (from the command line) in a file called ec2-env-setup. I'd appreciate any help.

Best Answer

This is called a script.

Right click on the text file, select properties, select permission, mark the "Let this file be executed" text box. Now you can execute it just by double clicking on the file.

You can also do it from the console like this:

sh ec2-env-setup.

Or change the permissions and afterwards execute it:

chmod u+x ec2-env-setup.
./ec2-env-setup.