2

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.

hobbes3
  • 615
  • 2
  • 10
  • 23

1 Answers1

5

/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.

bonsaiviking
  • 4,420
  • 17
  • 26
  • Oh I forgot about different users. That makes sense. Thanks! – hobbes3 Mar 02 '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 02 '12 at 20:05
  • Side note, .bash_profile is only called when a login shell is created. – David Mar 03 '12 at 04:03