Newbie Question PATH=$PATH
I log in as root and I modify the path statement as follows:
PATH=$PATH:/usr/local/src/prog
export PATH
For some reason, I keep losing this PATH. How do I get it to stay?
Thanks, MB
Linux
I log in as root and I modify the path statement as follows:
PATH=$PATH:/usr/local/src/prog
export PATH
For some reason, I keep losing this PATH. How do I get it to stay?
Thanks, MB
by chris derson
It sounds like you are entering this command at the '#' prompt. If this is the case then the changes you make to the PATH variable will only last for as long as that particular login session lasts. As soon as you log out the variables available to that specific session are lost.
To ensure that they are always set the way yoiu would like, you need to add this line to your .bash_profile, which you will find in the /root directory.
You can edit .bash_profile with vi, emacs, joe, vim or any other editor. You need to add the same commands you type at the '#' prompt somewhere (it shouldn't matter where) in the .bash_profile.
Remember that Linux (and every other flavour of Unix) treat files that start with a '.' as hidden, to see them in an ls listing you will need to list all files with either the -a or -A options. The -a option will show all files in the directory, -A will show all but the '.' and '..' directory entries.
I hope that this helps answer your question.
This discussion is closed to new replies.
Sort by Trending