Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm about to install "leiningen" which is a bash script for the clojure programming language with a lot of usefulness... ...but I'm not sure where it is appropriate to -put- a executable script in the linux system so that it's permanently and stable-ly available.

I don't think that anywhere in /home makes sense, but I don't know which directory/directories are supposed to be used for that.


share|improve this question
up vote 31 down vote accepted

(Note: ~ translates as /home/user in this post)

Personally, I put all of my custom-made system scripts in /usr/local/bin and all of my personal bash scripts in ~/bin. Very few programs I install place themselves in /usr/local/bin directory so it's not very cluttered and it was already in the $PATH variable on most of my machines.

To add /usr/local/bin to your system path (if it's not already there) add this to /etc/profile:

export PATH

To add ~/bin to your user's path add this to ~/.bash_profile:

export PATH

Sometimes the default .bash_profile file will have an if statement that automatically adds ~/bin to $PATH if it exists, so create the ~/bin and open a new terminal to see if yours already does this.

share|improve this answer
The BSDs do this by default. – Chris S May 7 '10 at 3:47
@Chris: BSDs put a lot of stuff in /usr/local/bin – Dan Andreatta May 7 '10 at 11:25

/usr/local/ is really the right place, while /opt is really for third party applications; "/opt is reserved for the installation of add-on application software packages." This is part of the Filesystem Hierarchy Standard.

See for discussion on /opt.

For /usr/local/, it is for "use by the system administrator". Just don't forget about stuff in there -- document it.

share|improve this answer
The link that you provided tells "The directories /opt/bin, /opt/doc, /opt/include, /opt/info, /opt/lib, and /opt/man are reserved for local system administrator use." There is nothing about /usr/local. Only /usr/local/share is mentioned there. On the other hand, compiled programs are usually installed into /usr/local on Linux. Don't you think /opt/bin is better place for use by the system administrator? – raacer Oct 31 '15 at 0:16

Historically you'd use something like /opt. Anything is fine as long as it's updated in $PATH for the users who are supposed to have it (hence anything in /home being a bad idea).

share|improve this answer

/usr/share/clojure seems like a common place to put clojure's binaries and libraries — why I don't know, it seems a natural for /usr/local/share/clojure— so creating a site subdirectory under this for these bash scripts seems fine.

The general point is that it makes more sense to organise scripts by function, not have all bash scripts in the same place.

share|improve this answer

Your Answer


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.