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 ?

Nidal
  • 8,856
  • 11
  • 55
  • 74
  • 1
    [Is the Filesystem Hierarchy Standard a UNIX standard or a GNU/Linux standard?](http://unix.stackexchange.com/questions/98751/is-the-filesystem-hierarchy-standard-a-unix-standard-or-a-gnu-linux-standard/) – slm Jun 18 '14 at 19:22
  • 3
    Search this site for FHS, you'll find a lot of info is already here + the Wikipedia article. Mull that over and see they cover your Q. – slm Jun 18 '14 at 19:24

2 Answers2

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.

garethTheRed
  • 33,289
  • 4
  • 92
  • 101
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
denten
  • 400
  • 1
  • 11