tags:

views:

80

answers:

6
+1  Q: 

Fullpath in OS X

I am a few steps before starting my first real programming project and I am preparing my machine. I noticed that my fullpath (what I get when I "echo $PATH" in the terminal) does not look like a "normal" one (as I see "usr/bin" quite a lot of times). What does it mean? How does it affect my use of the terminal? And how, if, can I change it back to the default one?

EDIT: I can change it just by typing "PATH=the_name_of_the_path" but it's not permanent, if I quit the session I am running and start terminal again, what I get is "/Applications/lejos_nxj/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin" (and that's because I changed it some months ago so I could usel lejos_nxj, for a course at university). Is it better I change it back to the "normal" again or should I stop worrying about it? How can I change it anyway, in case I had to?

+1  A: 

$PATH is a variable specifying a set of directories where executable programs are located. It's normal to see /usr/bin there.

Basically, if you type a command on the terminal, like cat for example, it's going to look for cat in those directories. This way, you don't have to specify the full path to all your frequently used commands.

Ken Aspeslagh
+2  A: 

Here is an example of a "normal" path on a new OS X 10.6 install:

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
ennuikiller
A: 

$PATH under all *nixes is actually a list of colon-separated directories. Unless you see several times the /usr/bin entry, nothing's wrong (and even if you see it several times, it doesn't mean it's broken either).

At any rate, you should post what you get.

zneak
+1  A: 

My path looks like this:

frak:~ seth$ echo $PATH
/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin

Yours should look pretty much the same. Each directory is separated by ':'. However, even if you do have /usr/bin more than once, it won't make any difference.

Observe:

frak:~ seth$ whereis units
/usr/bin/units
frak:~ seth$ units attoparsecs/s m/s
    * 0.030856776
    / 32.407793

Add a /usr/bin again:

frak:~ seth$ PATH=$PATH:/usr/bin
frak:~ seth$ echo $PATH
/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin

And everything still works fine:

frak:~ seth$ whereis units
/usr/bin/units
frak:~ seth$ units attoparsecs/s m/s
    * 0.030856776
    / 32.407793
Seth
A: 

PATH is a shell variable specifying where to find executables. For example, if you do a ftp (file transfer), the shell will look for the command ftp in those directories in your PATH variable before executing it. There's nothing wrong with that. If /usr/bin is not specified in your PATH, then everytime you need to use ftp, you need to give full path name , eg /usr/bin/ftp

Note that for a normal user, /usr/sbin should not be in PATH because those in /usr/sbin are mostly administrative commands.

ghostdog74
+1  A: 

If you see the same entries repeated again and again, then you probably have a mixup with your .bashrc vs. .bash_profile. You should set the PATH in the .bash_profile, not .bashrc, to avoid this.

Paul A Jungwirth
I tried "sudo pico ~/.profile", changed the entry for PATH and now I get:/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/binLooks ok (=better than before).
sebkom
Sometimes a login file will do something like this to find binaries in non-standard places:export PATH=/oracle/bin:$PATHexport PATH=/www/bin:$PATHThe idea is to add just a folder or two to the existing path. The problem is that if you're not careful, your login files can get sourced multiple times, which leads to the ever-growing PATH problem.
Paul A Jungwirth