View Full Version : how do I change my PATH and make it stay that way
ryancw
07-07-2006, 10:15 PM
I'm installing Stata, a statistical analysis program. I'm at the part where I am supposed to "modify your shell startup script to include Stata in your path." The manual tells me to look for a file called .profile if I use sh or ksh as my shell; or a file called .cshrc if I use csh or tcsh as my shell, and then insert in that file the statement that adds /usr/local/stata to my path.
I can't find either of those files. I'm not sure what shell I use . . . bash, maybe?
Can anyone tell me how to change my path, permanently?
Thanks.
tom_servo
07-08-2006, 07:31 AM
I does depend on your shell. I believe that Debian (and most other distros) use bash by default, so that is probably what you have. You can set the path in either the ~/.bashrc or the ~/.bash_profile files. I cannot remember any more what the difference is between them (I think one is only used by interactive shell sessions, and one by shells running scripts, or something like that).
Here is a bit I added to my .bashrc file to put the bin directory in my home directory on the path. This first checks that the directory exists, and if it does, adds it to the end of the path.
if [ -d ~/bin ] ; then
PATH="${PATH}:~/bin"
fi
If you want this change to work for all users of the system you could add it to the system-wide /etc/bash.bashrc file, instead of the one in your home directory.
Alain
ryancw
07-09-2006, 10:23 PM
I found the piece of code you referenced above, in the ~/bash_profile. I added a similar piece, changing ~/bin for /usr/local/stata. It didn't work.
So then I changed it to simply:
PATH="$PATH:/usr/local/stata"
still didn't change my path
Then I tried
PATH="$PATH:/usr/local/stata"
export PATH
Still did not change my path.
What is the difference between bash_profile and bashrc?
xmixahlx
07-10-2006, 01:17 PM
try logging out and logging back in for changes to bash_profile
bash_profile is for LOGIN shells
bashrc is for NON-LOGIN shells
usually you reference bashrc in the bash_profile config if you modify them.
later
ryancw
07-10-2006, 10:03 PM
I had tried logging in and out, even powering off and back on, still no change to my PATH.
If I just open a terminal window on my desktop, and then type a command to start an application, like stata or vim or whatever, is that a login shell or a non login shell?
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.