How do I add a directory to my $PATH in Ubuntu and make the changes permanent?
| ||||
|
feedback
|
migrated from serverfault.com Sep 6 '11 at 7:35
This question came from our site for system administrators and desktop support professionals.
|
A path set in .bash_profile will only be set in a bash login shell ( For example
Btw, you can check the PATH variable of a process by looking at its environment in | |||||
feedback
|
|
edit
You will need to source your To source your
when in the home directory. | |||||||||||||||||
feedback
|
|
I think the better way in idealogy of Ubuntu is create new file under /etc/profile.d/
add there
and give right on executable
sorry for Bad English. | |||||||
feedback
|
|
For complete newbies (like I am) who are more comfortable with GUI:
| |||
|
feedback
|
|
To set it system wide, append the line To add the directory for only the logged-in user, append the same line to | ||||
|
feedback
|
|
Adding it to .bashrc will work but I think the more traditional way of setting up your path variables is in .bash_profile by adding the following lines.
According to this thread it appears as though Ubuntu's behavior is slightly different than RedHat and clones. | |||||||||||||||||
feedback
|
add there
| ||||
|
feedback
|
|
Whenever I "install" my folder of BASH scripts, I follow the pattern of the test for a $HOME/bin folder that's in most .profile files in recent versions of Ubuntu. I set a test that looks like
It works just about 100% of the time, and leaves me free to change it in a GUI text editor with a quick "Replace all" should I ever decide to move /scripts somewhere closer to my $HOME folder. I haven't done so in 6 Ubuntu installs, but there's "always tomorrow." S BZT | |||
|
feedback
|
|
For Ubuntu edit the
Then edit your .bash_profile as you need..... | |||||
feedback
|
