LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-25-2006, 10:41 AM   #1
marc1978
LQ Newbie
 
Registered: Oct 2005
Location: Ottawa in Canada
Distribution: Mandriva 2005 LE (10.2)
Posts: 13

Rep: Reputation: 0
How to change the default PATH value


Here's some content from my /etc/profile

if ! echo ${PATH} |grep -q /usr/X11R6/bin ; then
PATH="$PATH:/usr/X11R6/bin"
fi

if [ "$UID" -ge 500 ] && ! echo ${PATH} |grep -q /usr/games ; then
PATH=$PATH:/usr/games
fi

and in my $HOME/.bash_profile I have

PATH=$JAVA_HOME/bin:$PATH

but when I echo $PATH, I get:

/usr/java/jdk1.5.0_05/bin:/usr/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin/:/usr/games

Now my question is, where does all the rest of the PATH come from and how do I get rid of the parts I don't want?
 
Old 02-25-2006, 11:17 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 740Reputation: 740Reputation: 740Reputation: 740Reputation: 740Reputation: 740Reputation: 740
Partial answer--my machine (Ubuntu 5.10)

in /etc/gdm/gdm.conf there is a default PATH setting.

in /etc/profile, there is a conditional statement that appears to set PATH based on who is logged in

in ~/.bash_profile there is a conditional modification to PATH.

I don't know how all this works in detail, but I suspect the 3 above get applied in the order listed.

I'm still learning the details of the initialization process.....
 
Old 02-25-2006, 11:29 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
Actually, your path looks fine, unless you absolutely hate Java and don't run anything that uses it.
 
Old 02-25-2006, 11:36 AM   #4
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 64
Read these articles about the pathvar. This is what I think you are after.
http://www.linuxjournal.com/user/800643/track

Items like /etc/profile and /etc/bashrc setup enviroment variables and on my centos the /etc/profile removes the /sbin;/usr/sbin/;/usr/local/sbin and others from the default path created from the pathvar. It can be used to rearange the order the paths are in as well. Of course this may differ from distro to distro.

Brian1
 
Old 02-25-2006, 11:41 AM   #5
marc1978
LQ Newbie
 
Registered: Oct 2005
Location: Ottawa in Canada
Distribution: Mandriva 2005 LE (10.2)
Posts: 13

Original Poster
Rep: Reputation: 0
I'm using Mandrake and don't have a /etc/gdm directory.

I'm not looking to remove JAVA from the path, I'm just curious as to where these default values come from and how to remove them if you would like to. Also, why is /usr/bin there twice???

/usr/java/jdk1.5.0_05/bin:/usr/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin/:/usr/games
 
Old 02-26-2006, 10:45 AM   #6
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 64
I don't know exactly where a default file exist that is editable. I only know of modifing using commands like in the above link as far as removing or adding or even rearrange the order of the path. As to why there is 2 alike is hard to know. There are many files during a boot that can be read to modify paths like /etc/profile and even in your own directory as well.

Brian1
 
Old 02-28-2006, 07:09 AM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
You might have /usr/bin added in both /etc/profile and $HOME/.bash_profile.
Also check the $HOME/.bashrc file. You don't want to add paths in .bashrc because if you call a subshell, the path variable will grow on you with duplicates. .bashrc is run everytime a new shell is started, while $HOME/bash_profile is run once, when you log in. As to when a particular path is added, read through your startup scripts. You could also use grep to try to find which files add it to the path.

Last edited by jschiwal; 02-28-2006 at 09:17 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
default path for OpenOffice? mcd Mandriva 1 05-29-2004 07:37 AM
How to edit default PATH? davidas Linux - Newbie 2 03-20-2004 06:34 AM
Default PATH Itsu Linux - Software 5 01-30-2004 08:27 AM
Default path log Linux - Newbie 1 01-13-2003 10:13 AM
default path for licq glock19 Linux - General 1 01-03-2002 03:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration