Adding to the path

This is a simple note on how to add a directory to your PATH. The $PATH environment variable is a list of all directories in which Linux will look for commands, scripts and programs. Linux uses the bash shell. When an account is created using Linux user manager, or linuxconf, a file called .bash_profile is created in the user home directory, similar to the one shown below:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
         . ~/.bashrc

# User specific environment and startup programs



The line we are interested is: PATH=$PATH:$HOME/bin

This line is defining the PATH for your logon in the bash shell as the general PATH variable -- $PATH -- plus your home directory -- $HOME -- subdirectory bin.

To add a directory to the PATH just edit this line including a colon : and the new directory. For example to add:   /usr/programs/bin   to the PATH you would change the line to:


You will need to logout and login again for this change to take effect, of course.

(You can see the value of $PATH or $HOME by typing echo $PATH, or echo $HOME. Please note that the root user will have a different path than common users.)

This page is maintained by Al Bento who can be reached at This page was last updated on April 10, 2001. Although we will attempt to keep this information accurate, we can not guarantee the accuracy of the information provided.