Michael Bovee wrote: > Okay, apologies in advance, but something I _just dont get_ is the PATH > variable. > (I'm a born and raised Macintosh user so please bear with me) > I bought a SAMS Teach Yourself book on Unix, but it says nothing about > WHY this PATH thing is even necessary. (Under MacOS... if I invoke the > 'FIND' command it just looks everywhere all the time) > > I just want to execute a command, or find a file, something 'simple'
Michael, here are few things to try in order to see what is really going on for you. First of all, I assume you are either running a terminal window that has a command prompt or you bypassed X altogether to get a regular text login. Either way you should see a shell prompt. Unfortunately there is more than one possible shell prompt, AND the prompt is customizable too! Sometimes too much flexibility gets confusing eh? I doubt that the Mac actually looks everywhere in order to run a program. Each Mac file has (or had, before OS X) two forks, one for data and one for program information. The program information fork had stuff like which application made the file, where it was on disk, how large it was, etc. Furthermore the icons on your desktop, and the menu choices, all have properties that specify where to find the program. You'll find the Linux icons do the same thing. The deal with the PATH variable is this. In the pre-GUI world that UNIX was born in it was impractical to search everywhere on the system each time a command was typed in. Computers were slow, tiny, and slow. Did I mention slow? Anyway, the PATH variable provides a way to look in a well defined set of locations for things that could look like commands. This makes things much faster. Enough history, let's debug. First of all, you can see what your PATH variable is set to by typing this: echo $PATH Of course, there's more than one way to do it, but this is simple. Typically PATH will include things like: /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin/X11:/usr/X11R6/bin The order is important. The directories are searched from left to right. The first match wins. If your PATH variable is short this may be part of your problem. But let's trudge on just to cover the bases. Every command has a home on the system. Typically commands that must be run when starting the computer, before most things are ready to use, go in /sbin (this is for the Standalone BINaries). Things that are often used in startup but aren't needed until after the filesystems are mounted go in /usr/sbin. General system commands and utilities can be found in /bin and /usr/bin (the discinction between the two is less clear, at least to me.) And then programs that are unusual, out of the ordinary, etc. typically go in /usr/local/bin. You may also find things under /opt, /usr/share, and various other odd places. The point of this long-winded paragraph is to be able to say that if you know the home for a command then you can type the entire path to the command in order to run it no matter what your PATH variable is set to! The easy way to find out which home a command has is to use the 'which' command. Unfortunately this won't help if your PATH is a mess because it searches the PATH variable in order to tell you which home it found your command in. FYI the which command can be spelled out as '/usr/bin/which' (I included the apostrophes just to make it clear what the entire command was, don't type them.) Okay, so what if which doesn't help you? Then try this: /usr/bin/find / -name yourcommandgoeshere -follow Do this as root for best results. This will look EVERYWHERE for yourcommandgoeshere and then tell where it found it, if it found it. See if that helps get you rolling. -- Dan Coutu Managing Director Snowy Owl Internet Consulting, LLC Mobile: 603-759-3885 Fax: 603-673-6676 ***************************************************************** To unsubscribe from this list, send mail to [EMAIL PROTECTED] with the text 'unsubscribe gnhlug' in the message body. *****************************************************************
