If you're using bash
(and you probably are if you're running Linux), the first thing you should do is change your ~/.bash_profile
to include your own binary directory in the path.
Add the following line to the end of it:
export PATH=$PATH:~/bin
Then create that directory with:
mkdir ~/bin
Then put whatever executables you want to use into that directory. Voila, whenever you log in, they will be available.
Keep in mind that bash
will search your path for the first runnable program with that name so, if you want to make an awk
, ls
or cp
command, you'll need your ~/bin
directory to come before the system directories in your path. But this is usually a bad idea - better to name your executables so they don't clash with real ones (until you know what you're doing of course, then you can replace or trap system executables to your heart's content).
In answer to your update as to how to set an environment variable, it's a simple (in bash
):
export name=value
which will create an enviroment variable name
and give it the value value
. It's worth using export
rather than set
since that makes it available to sub-processes.