7

I'm trying to understand Linux file system, and one of the question is:

1- Why there are multiple folders for executable files: /usr/bin, /usr/sbin/ and /usr/local/bin? Is there any differences between them ?

2- If I have an executable file and I want to add it to my system, which of the third latter locations is the best for me ?

2

2 Answers 2

6
  1. Run man hier from the command line to get the answer to your first question.
  2. It depends. See /usr/bin vs /usr/local/bin on Linux
2
  • Hehe, "man hier" reads in German somewhat like "man, [look] here!" Which sounds like an unfriendly call or hint to look at something obvious. :) Jun 18, 2014 at 20:22
  • Heh, yes. hier stands for "hierarchy" in this case.
    – denten
    Jun 18, 2014 at 20:28
6

It's called the Filesystem Hierarchy Standard and the gory details can be found here

Generally:-

/usr/bin is for user programs.

/usr/sbin is for system programs - those that are used by admins, but not general users.

Both the above begin with /usr and the standard states that these could be hosted on a shared server (using NFS, for example) and accessed by the various hosts on a network. The variants without the /usr (that is /bin and /sbin) are for essential programs that the system needs to boot (as the files in /usr tree won't be available if they're on a NFS share).

/local/bin are for locally compiled user programs.

If you have an executable, which wasn't installed using the system's package manager, then I suppose you should place it in /usr/local/bin if it's to be used by many users, or you could leave it in your home directory if it's only going to be used by yourself.

Not the answer you're looking for? Browse other questions tagged .