next up previous contents
Next: Aliases Up: Customizing your shell and Previous: Changing your shell prompt   Contents


Setting the path: how the shell finds programs

When the user types in the name of a program to run, the shell searches a list of directories for the program and invokes the first such program found. The list of directories to search is given by the PATH environment variable.

Normally you don't want to override the system settings; instead, append to the current PATH
[amit@onyx]: export PATH="$PATH:/extra/dir"
with new entries delimited with a colon. The setting for the PATH variable goes in .bash_profile or .bashrc file.

A common situation is that the current directory is not in your path. So you have to specify the path using the dot notation:

./myprog

While that works, we can add the current directory to the PATH so that we do not have to prefix each time with the ./ prefix. Here is the setting.

export PATH=$PATH:.

Add this line at the end of your .bashrc file in your home directory.


next up previous contents
Next: Aliases Up: Customizing your shell and Previous: Changing your shell prompt   Contents
Amit Jain 2013-04-22