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?


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

  • 2
    Why do some programs exist in both directories?
    – CJ7
    Feb 2 '16 at 5: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 2 '16 at 5:54
  • 1
    /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 2 '16 at 14:15

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

  • 2
    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 3 '16 at 12:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.