Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

There are no. 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 writting the script name on user prompt ? May be sthin interesting to know about /usr/local/bin/ on LINUX system :-)

share|improve this question
    
I guess, this question will live a happier life over at superuser.com –  Boldewyn Sep 24 '10 at 8:40
add comment

migrated from stackoverflow.com Sep 24 '10 at 11:37

This question came from our site for professional and enthusiast programmers.

4 Answers

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

/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.
share|improve this answer
add comment

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

share|improve this answer
    
yes, got it, this clears my doubt :-) –  Ashish Sep 25 '10 at 9:20
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.