It sounds like you may want to modify your $PATH environment variable. You can do this fairly easily, but you should read man bash
before you follow anybody's advice. bash
reads several configuration files when it starts, and reading the man page will inform you of the order these are read.
Before describing the change, know where the change should go (which of the several config files). I'd recommend you use this one:
~/.profile
(where ~
is just shorthand for your home directory),
or you may consider putting the change in this file:
~/.bash_profile
You should decide which one to use after reading man bash
And if the file you choose is not in your home directory, you will create it by entering:
touch ~/.profile
(for example)
Before changing your path, you should know what it is now. This will tell you what the current path is:
echo $PATH
You should probably copy and paste that path somewhere (as a comment line in ~/.profile
would be a good choice IMHO). This will make it easier to restore if things go south.
To change your path, you should add to it instead of replacing it. The order of the path variables is important because that's the order the shell will search. You can add to either the front end or the back end of the path, but for your case, I would recommend adding to the back end. Let's change it temporarily to begin with:
export PATH=$PATH:~/your/path
(where your/path
is the location you wish to append to your path)
For example if you want to add a folder in your home directory ~/myscripts
to your path, this would be the command:
export PATH=$PATH:~/myscripts
You can check to see if that had any effect with:
echo $PATH
And you should see the path you've just added at the end of the list of paths
And so if you're happy with that, open the file ~/.profile
in your editor, and add the line you've just used at the end of the file:
export PATH=$PATH:~/myscripts
And that's it. the path that you've added will become part of your "environment" each time to start up the shell. If you want to change it again, just edit ~/.profile
to reflect your tastes.