Home » What is /usr/local/bin?

What is /usr/local/bin?

Solutons:


/usr/local/bin is for programs that a normal user may run.

  • The /usr/local hierarchy is for use by the system administrator when installing software locally.
  • It needs to be safe from being overwritten when the system software is updated.
  • It may be used for programs and data that
    are shareable amongst a group of hosts, but not found in /usr.
  • Locally installed software must be placed within /usr/local rather than /usr unless it is being installed to
    replace or upgrade software in /usr.

This source helps explain the filesystem hierarchy standard on a deeper level.

You might find this article on the use and abuse of /usr/local/bin interesting as well.

/usr/, I assume is the user of the computer.

Close.

Unix started out as a multi-user operating system, so it’s not “the user,” it’s “the users,” plural.

Before AT&T Unix System V Release 4 (SVR4) came out in 1988 with its user management tools defaulting to creating user home directories in /home, the conventional location was /usr.¹ Your $HOME directory might have been /usr/jfw on a System III box.

/usr also contained, then as now, /usr/bin, /usr/lib, etc. Experience showed that segregating the home directories was good system management practice, so with the /home policy change in SVR4, it left behind everything we now think of as belonging in /usr.

/usr still had a good reason to hold onto the name: what got left behind were files that didn’t need to be available until the system was booted up far enough to support normal interactive use. That is to say, what was left behind were the user-focused parts of the OS. This meant that /usr could be on a different physical volume, which was a good thing back in the days of 92 MB hard disk drives the size of washing machines.

Early Unix systems were careful to keep the core OS files out of /usr so that you could still boot into single-user mode² even if the /usr volume was unmountable for some reason. The root volume contained sufficient tools to get the /usr volume back online.

Several Unix flavors now disregard this old design principle since even small embedded systems have enough room for both the traditional root volume files and all of /usr on a single volume.³ Red Hat Enterprise Linux, Solaris and Cygwin symlink /bin to /usr/bin and /lib to /usr/lib so that there is no longer any difference between these directories.

…/local/…obviously stands for the local computer…

Yes. It refers to the fact that files under /usr/local are supposed to be particular to that single system. Files that are in any way generic should live elsewhere.

This also has roots in the way Unix systems were commonly used decades ago when all this was standardized. Again, hard disks of the time were bulky, really expensive, and stored little by today’s standards. To save money and space on disks, a computer lab full of Unix boxes would often share most of /usr over NFS or some other network file sharing protocol, so each box didn’t have to have its own redundant copy.⁴ Files specific to a single box would go under /usr/local, which would be a separate volume from /usr.

This historical heritage is why it’s still the default for most third-party Unix software to install into /usr/local when installed by hand. Most such software will let you install the package somewhere else, but by making a non-choice, you get the safe default, which doesn’t interfere with other common install locations with more specific purposes.

There are good reasons to make software install somewhere else instead. Apple’s macOS team does this when they build, say, bash from the GNU Bash source code. They use / as the installation prefix, overriding the /usr/local default, so that Bash ends up in /bin.

Another example is the way older Linux systems segregated their GUI software into /usr/X11R6, to keep it separate from the traditional command line and curses-based software. This was done simply by overriding the default /usr/local prefix with /usr/X11R6.⁵

And what is /bin?

It’s short for “binary,” which in this context means “a file that is not plain text.” Most such files are executables on a Unix box, so these two terms have become synonymous in some circles. (“Please build me a binary for RHEL 7, Fred.”)

Text files on a Unix box live elsewhere: /etc, /usr/include, /usr/share, etc.

Once upon a time, even shell scripts — which are plain text files — were kept out of bin directories, but this line, too, has blurred. Today, bin directories typically contain any kind of executable file, whether strictly “binary” or not.⁶


Footnotes and Digressions:

  1. The primitive nature of the user management tools prior to SVR4 meant that the HOME=/usr/$NAME scheme was merely documented as a convention, rather than enforced by software tools as a default.

    You can see this on page 4-8 of the “AT&T Unix System V Release 3.2 System Administrator’s Guide: here you see AT&T recommending the old /usr/$NAME scheme in the last major version of Unix before SVR4 came out.

    It was fairly common in older Unix systems for the system administrators to choose a different scheme that made more sense to them. People being people, that meant a lot of different schemes got invented.

    One scheme I came across before /home/$NAME became the standard was /u/$NAME.

    Another system I used in the early 1990s had so many users that they couldn’t fit all the home directories onto a single physical volume, so they used a scheme like /u1/$NAME, /u2/$NAME, and so on, as I recall. Which disk your home directory ended up on was simply a matter of which one had space on it at the time your account was created.

  2. You can boot a macOS box into single-user mode by holding down Cmd-S while it boots. Let go once the screen turns black and you see light gray text appear. It’s like running under the Terminal, but it takes over the whole screen because the GUI hasn’t started yet.

    Be careful, you’re running as root.

    Type “exit” at the single-user root prompt to leave single-user mode and continue booting into multi-user GUI mode.

  3. Unixy OSes that still appear to keep critical single-user mode files out of /usr may not, in fact, do so these days. I once rendered a FreeBSD 9 box unbootable by moving /usr to a ZFS volume. I forgot that the ZFS-on-root features didn’t land until FreeBSD 10, creating a Catch 22: the OS needed files in /usr in order to mount /usr!

    That was bad enough, but if FreeBSD 9 were still keeping its single-user boot stuff out of /usr, I could have fixed it in place. Since it wouldn’t boot even to single-user mode with /usr being unmountable, clearly that tradition had been violated somehow. I had to boot from a rescue CD to get that system back up again.

  4. This is also where we get /usr/share: it segregates files that could be shared (e.g. over NFS) even between Unix boxes with different processor types. Typically, text files: man pages, the dictionary, etc.

  5. “X11R6” referred to the version of the X Window System underpinning Linux GUIs at the time this convention was prevalent. Linux systems generally stopped segregating the GUI software about the time X11R6 was replaced with X.Org.

  6. The original Unix systems kept their core shell scripts in /etc in order to avoid commingling them with the true binaries in /bin.

/usr/local/bin shows the UNIX-esque roots of the latest Mac OS (its BSD based under there).

  • “usr” stands for UNIX System Resources. This is the location that system programs and libraries are stored.
  • “local” represents resources that were not shipped with the standard distribution and, usually, compiled and maintained on a per site basis.
  • “bin” represents binary compiled executables.

This has morphed since the early implementations of UNIX to Linux and BSD, but the convention has stayed. Now, /usr/bin would be for “main” or core programs and libraries where /usr/local/bin would be for add-on and non-critical programs and libraries.

Related Solutions

Joining bash arguments into single string with spaces

[*] I believe that this does what you want. It will put all the arguments in one string, separated by spaces, with single quotes around all: str="'$*'" $* produces all the scripts arguments separated by the first character of $IFS which, by default, is a space....

AddTransient, AddScoped and AddSingleton Services Differences

TL;DR Transient objects are always different; a new instance is provided to every controller and every service. Scoped objects are the same within a request, but different across different requests. Singleton objects are the same for every object and every...

How to download package not install it with apt-get command?

Use --download-only: sudo apt-get install --download-only pppoe This will download pppoe and any dependencies you need, and place them in /var/cache/apt/archives. That way a subsequent apt-get install pppoe will be able to complete without any extra downloads....

What defines the maximum size for a command single argument?

Answers Definitely not a bug. The parameter which defines the maximum size for one argument is MAX_ARG_STRLEN. There is no documentation for this parameter other than the comments in binfmts.h: /* * These are the maximum length and maximum number of strings...

Bulk rename, change prefix

I'd say the simplest it to just use the rename command which is common on many Linux distributions. There are two common versions of this command so check its man page to find which one you have: ## rename from Perl (common in Debian systems -- Ubuntu, Mint,...

Output from ls has newlines but displays on a single line. Why?

When you pipe the output, ls acts differently. This fact is hidden away in the info documentation: If standard output is a terminal, the output is in columns (sorted vertically) and control characters are output as question marks; otherwise, the output is...

mv: Move file only if destination does not exist

mv -vn file1 file2. This command will do what you want. You can skip -v if you want. -v makes it verbose - mv will tell you that it moved file if it moves it(useful, since there is possibility that file will not be moved) -n moves only if file2 does not exist....

Is it possible to store and query JSON in SQLite?

SQLite 3.9 introduced a new extension (JSON1) that allows you to easily work with JSON data . Also, it introduced support for indexes on expressions, which (in my understanding) should allow you to define indexes on your JSON data as well. PostgreSQL has some...

Combining tail && journalctl

You could use: journalctl -u service-name -f -f, --follow Show only the most recent journal entries, and continuously print new entries as they are appended to the journal. Here I've added "service-name" to distinguish this answer from others; you substitute...

how can shellshock be exploited over SSH?

One example where this can be exploited is on servers with an authorized_keys forced command. When adding an entry to ~/.ssh/authorized_keys, you can prefix the line with command="foo" to force foo to be run any time that ssh public key is used. With this...

Why doesn’t the tilde (~) expand inside double quotes?

The reason, because inside double quotes, tilde ~ has no special meaning, it's treated as literal. POSIX defines Double-Quotes as: Enclosing characters in double-quotes ( "" ) shall preserve the literal value of all characters within the double-quotes, with the...

What is GNU Info for?

GNU Info was designed to offer documentation that was comprehensive, hyperlinked, and possible to output to multiple formats. Man pages were available, and they were great at providing printed output. However, they were designed such that each man page had a...

Set systemd service to execute after fstab mount

a CIFS network location is mounted via /etc/fstab to /mnt/ on boot-up. No, it is not. Get this right, and the rest falls into place naturally. The mount is handled by a (generated) systemd mount unit that will be named something like mnt-wibble.mount. You can...

Merge two video clips into one, placing them next to each other

To be honest, using the accepted answer resulted in a lot of dropped frames for me. However, using the hstack filter_complex produced perfectly fluid output: ffmpeg -i left.mp4 -i right.mp4 -filter_complex hstack output.mp4 ffmpeg -i input1.mp4 -i input2.mp4...

How portable are /dev/stdin, /dev/stdout and /dev/stderr?

It's been available on Linux back into its prehistory. It is not POSIX, although many actual shells (including AT&T ksh and bash) will simulate it if it's not present in the OS; note that this simulation only works at the shell level (i.e. redirection or...

How can I increase the number of inodes in an ext4 filesystem?

It seems that you have a lot more files than normal expectation. I don't know whether there is a solution to change the inode table size dynamically. I'm afraid that you need to back-up your data, and create new filesystem, and restore your data. To create new...

Why doesn’t cp have a progress bar like wget?

The tradition in unix tools is to display messages only if something goes wrong. I think this is both for design and practical reasons. The design is intended to make it obvious when something goes wrong: you get an error message, and it's not drowned in...