26

What is the difference between /usr/bin and /usr/local/bin?

Why are there both directories and why do some executable programs exist in both directories?

CJ7
  • 829

2 Answers2

33

/usr/bin : contains executable programs that are part of the operating system and installed by its package manager

/usr/local/bin : default location for executable programs not part of the operating system and installed there by the local administrator, usually after building them from source with the sequence configure;make;make install. The goal is not to break the system by overwriting a functional program by a dysfunctional or one with a different behavior.

When the same program exists in both directories, you can select which ones will be called by default by rearranging the order of the directories in your PATH.

jlliagre
  • 61,204
  • 2
    Why do some programs exist in both directories? – CJ7 Feb 02 '16 at 05:47
  • 2
    Precisely because there is one version part of the OS and another one built locally, presumably a newer one but not necessarily. – jlliagre Feb 02 '16 at 05:54
  • 2
    /usr/bin also was a path for executables that are not part of the OS. This was in the 1970s and maybe it helps to understand that using /usr/local/bin is repeating the mistakes from the 1970s. – schily Feb 02 '16 at 14:15
-1

/usr/bin is general system-wide binaries that contains most of the executable files (i.e., ready-to-run programs) that are not needed for booting (i.e., starting) or repairing the system.

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

msc
  • 537
  • 3
    Not my downvote but you probably want to rephrase at least your last sentence. /usr/bin is also for programs that a normal user may run. By the way, "not normal" users might equally run whatever they choose to. – jlliagre Feb 03 '16 at 12:51