Discussion Locked

Newbie Question -add to the PATH

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I can't seem to get anything I add to the PATH to stick. I log in as root and type the following at command line to add a directory called prog:

PATH=$PATH:/usr/local/src/prog
export PATH

This holds for a while (1 day maybe) then it disappears from the path. How can I get it to stay in the PATH??? Thx, MB

5 replies

by vinnyd

To set that path the best way I know is to use VI to edit the root users .profile

Login as root

That should put you in the root directory.

Then type vi .profile

Find the PATH line and add you /usr/local/src/prog to the path that exists and then save the file.

Now each time the root user logs in that path will be set.

by gregsptl

if your using bash ( the default linux shell) edit your home directory's .bash_profile - file and add the following

PATH=$PATH:/usr/local/src/prog
export PATH

if your using ksh edit .profile

these would be ~/.bash_profile and ~/.profile respectively

This discussion is closed to new replies.