1

There are a number of scripts present at this path: /usr/local/bin/.

For the user, the instructions are to type the script name <script_name> at his prompt [username@servername]$. How can that be possible that I didn't type ./script_name and script started to show results on standard output by just writing the script name on the user prompt?

1
  • I guess, this question will live a happier life over at superuser.com
    – Boldewyn
    Sep 24, 2010 at 8:40

4 Answers 4

2

/usr/local is for stuff that you don't want destroyed when you upgrade the operating system.

The OS is free to blow away anything it wants in /usr/bin et al, the local variation was set up to prevent this from destroying your non-OS stuff.

And, by placing all this local stuff (bin, etc, and so on) under one control point, it makes backing up of a site very easy (as opposed to having to get /bin, /etc, /lib and so on for the OS stuff) - you just back up the entire /usr/local hierarchy.

If you echo $PATH, you'll probably find that /usr/local/bin is there. Alternatively, try which PROG (replacing PROG with your actual program name) to see where it's being found:

pax> pwd
/home/pax

pax> echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin

pax> ls /usr/local/bin/ico*
iconv

pax> which iconv
/usr/local/bin/iconv

pax> iconv -?
Usage: iconv [-c] [-s] [-f fromcode] [-t tocode] [file ...]
or:    iconv -l
Try 'iconv --help' for more information.
1

On BSD systems, all non-system software (ports) are installed in /usr/local by default.

On most Linux distributions it is intended to be used for software installed by the local administrator from source, bypassing the distributions package manager.

0

/usr/local/bin is probably part of your path

0

To answer your title about the purpose of the /usr/local/bin /usr/local are for software local to the machine, usually installed manually (and not via a package management like rpm or deb)

To answer your actual question, I think you should learn about the PATH variable. try echo $PATH in a terminal

./somescript.sh means you are expecting the script to be in the current directory (the .) if you do not put any path, just the name of a command, the shell will look in the PATH to find the command (unless of course it is an internal command of your shell).

1
  • yes, got it, this clears my doubt :-)
    – Ashish
    Sep 25, 2010 at 9:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .