Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have noticed that almost every website tells you to add something like export PATH=/usr/local/share/python:$PATH in your .bashrc or .bash_profile when modifying a PATH.

When you want to know what your PATH is, you can echo $PATH, but you get this one-liner response which is kind of hard to read

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin

So I found out you can just sudo vi /etc/paths and not worry about adding anything to your bash profiles. Is this a bad method? It seems to be more clear and easier in my opinion. I guess maybe people are afraid you can mess up the paths and forget how to revert it back to the original state?

By the way, I'm running Mac Lion. But my question is for Linux in general.

share|improve this question
3  
/etc/paths is OS-X specific and not part of any Linux distro I've used. –  Mark Wagner Mar 2 '12 at 19:34
add comment

1 Answer

up vote 5 down vote accepted

/etc/paths does not exist on my Ubuntu system, so it may not be a GNU standard way of setting your PATH.

Another thing to consider is that changing /etc/paths will change the PATH of every user on the system. By putting it into your .bash_profile, you limit the change to one user, and only when that user uses bash as his shell.

share|improve this answer
    
Oh I forgot about different users. That makes sense. Thanks! –  hobbes3 Mar 2 '12 at 19:55
    
GNU/Linux should check /etc/profile instead of /etc/paths... but yeah, the gist is that the shell interprets those files to look for system wide settings before it processes the users .bashrc/.profile –  InChargeOfIT Mar 2 '12 at 20:05
    
Side note, .bash_profile is only called when a login shell is created. –  David Mar 3 '12 at 4:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.