Results 1 to 3 of 3
Hey all, I am trying to add a path to my PATH variable on redhat linux and seem to be having problems. I can set the path variable like this:
...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-15-2013 #1Just Joined!
- Join Date
- Feb 2013
- Posts
- 1
altering PATH variable
Hey all, I am trying to add a path to my PATH variable on redhat linux and seem to be having problems. I can set the path variable like this:
PATH=$PATH:/my/dir
export PATH
and that works fine but its not a permanent fix. Also, that only works for the current terminal session. If I try and open another terminal session I would have to retype in the commands. I have read I need to change my ~/.bash_profile file but that file does not exist. I created the file in the ~ directory and added the two lines above but when I log out and log back in, the PATH variable is not changed. Any help would be great!
- 02-15-2013 #2
Try putting it into .bashrc. You might find this article useful.
"I'm just a little old lady; don't try to dazzle me with jargon!"
- 02-15-2013 #3Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,143
What hazel suggests will work, but isn't optimal. It is best to put the in your ~/.bash_profile instead:
File names that start with a dot are "invisible", which is probably why you don't see it normally. ~ is your home directory (accessible also with the $HOME environment variable). In any case, if bash is your default shell, then you MUST have the following files in your home directory:Code:export PATH="${PATH}:/my/dir"
1. .bash_history
2. .bash_logout
3. .bash_profile
4. .bashrc
Just for my information, what distribution+version of Fedora/RedHat are you running?Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote
