This tutorial is intended to cover installing short single file scripts that you might copy from forums. It won't cover compilation and won't cover installation of programs from online repositories such as google code; they should have an INSTALL or README file with specific install instructions. For information on installing normal applications please see the package management section of Explanation of Linux.
If you plan on downloading more than one or two files it's probably a good idea to make a directory and add it to your PATH; this means if you run a script from the terminal you won't have the write the full path, just the file name.
First to create a directory, In the terminal type:
or in the file manager APPLICATIONS Thunar by default: right click –> Create Folder, and then name it.
I named it
bin, but you could call it
script or whatever you want.
next to add it to your 'path'.
Open up the text editor (in the main menu), make sure you have selected hidden files to be shown (in Linux files prepended by a dot '.' are hidden by default), and open
Alternatively in the terminal:
(or you favourite editor). Then somewhere, preferably nearer the bottom add:
Save and exit.
To reload without restarting your computer, enter in a terminal:
Now you should be able to run programs in that directory without writing the full path.
Most of the scripts you get (if you don't install the from the repositories) will probably be copy and pasted from web sites. Simply save them into the directory setup above; the name doesn't really matter. The extension isn't really used for scripts, Linux uses a line at the beginning of the file to identify what interpreter to use, that line will look something like
#! /usr/bin/perl or
#! /usr/bin/env python.
Next you need to make it executable, anything downloaded from the internet by default doesn't have execute permissions. To make a script executable simply open a terminal and type:
chmod +x ~/bin/yourscriptname
(assuming you called your directory 'bin').
You may also see instructions telling you to do:
chmod 777 ~/bin/yourscriptname
this is basically the same, (it will add extra permissions too) but is equivalent, I find '+x' easier to remember though (add eXecute (permissions)).
That's it, your script is ready to run.