How to create a script in Ubuntu

I’m not very skilled when it comes to using the command line in Ubuntu so these instructions may be incomplete. Follow them at your own risk. It would probably be a better idea to learn how to do this from other resources such as If you still want to try to follow my instructions then your are brave indeed.

To quickly perform repetitive tasks from the command line in Linux you can create a script. Here are the basic steps:

1. Create a text file containing the command or commands you want to perform.
2. Use the chmod command to make the text file executable:

sudo chmod +x /usr/local/bin/sampleprogram

If the text file you created was called “sampleprogram” and it is in the /usr/local/bin directory then to run the command you will need to issue the command like this:

cd /usr/local/bin

Putting the dot and then the slash in front of your command tells the command interpreter that you want to run the command called “sampleprogram” that is in the current directory.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s