Breadcrumbs 
Learning >> Documentation >> Configuring the Shell >> Changing / adding to path
 
Recent News
We Want You!
Come and get involved! (And Christmas Party!
[ more ]
Make your own Xbox games!
Learn to make Xbox 360 games
[ more ]
New Committee
A new committee has been appointed.
[ more ]
Changing / Adding to your PATH
Changing / Adding to your PATH

At the shell, type

$ echo $PATH

PATH is a so-called environment variable. When you type the name of a command, bash looks through the locations listed in your $PATH to find it. Normally the PATH environment variable is just set to the directories where the commands you use reside (i.e. /bin, /usr/bin, etc). This is usually already configured for you by the Server Administrators. But if you regularly use programs that aren't installed on frink, you can put them in a special directory and add that to your PATH. Thus you can just type their names at the shell like an ordinary command.

For example:

$ mkdir ~/bin

This makes a subdirectory in your home directory called 'bin'. This is where you will put the programs you want to have in your $PATH.

$ mv my_program ~/bin

This moves your program (e.g. some C program you compiled yourself) to the directory.

$ echo 'PATH="$PATH:~/bin"' >> .bashrc

Here we are just adding a line to your .bashrc file. The '>>' means append to the file that follows. In this case if we break it down:

PATH = " $PATH : ~/bin "

This tells bash to append ~/bin to your PATH.

$ source .bashrc

Execute .bashrc (i.e. resets your shell environment).

$ my_program

And bash will understand where to look for it. You will not get a 'Command not found' error as we have configured the shell to know to look in the ~/bin directory for anything we type (provided it does not already exist on the system).

Finally lets have a look at how to change the command prompt.