differences between /bin, /usr/bin and /usr/local/bin

  • Follow


Hello,

What are the differences between /bin, /usr/bin and /usr/local/bin? I
dont understand how the binaries are sorted out in these three
directories. If someone can clarify, i'd appreciate it.
0
Reply smith4894 9/16/2003 7:18:11 PM

In article <87fbf9fb.0309161118.6f57ac0e@posting.google.com>, gorda wrote:
> Hello,
> 
> What are the differences between /bin, /usr/bin and /usr/local/bin? I
> dont understand how the binaries are sorted out in these three
> directories. If someone can clarify, i'd appreciate it.

This differs between different Unix and Unix-like operating systems.

/bin
    Statically linked essential (from admin point of view)
    binaries on the / filesystem.  Should be available in case
    of problem when one needs to boot into single user mode and
    haven't got the other filesystems on-line yet.

/usr/bin
    Dynamically linked binaries, possibly on a different
    filesystem.  Often hold a lot more than /bin.

/usr/local/bin
    Other binaries, third party programs (posssibly, or they
    might be in /opt/bin), elsewhere.


See the Filesystem Hierarchy Standard (FHS):
    http://www.pathname.com/fhs/

Many Unices don't care about FHS.

On a BSD system, the first two are part of the "base system",
but /usr/local is a hierarchy where one puts third party stuff
("ports" and "packages").  On OpenBSD, only the base system
has had its source put through a security audit.  NetBSD uses
/usr/pkg instead of /usr/local.  Binaries in /bin on FreeBSD
systems are dynamic (or I misunderstood something).

-- 
Andreas K�h�ri
0
Reply Andreas 9/16/2003 7:37:14 PM


smith4894@excite.com (gorda) wrote in 
news:87fbf9fb.0309161118.6f57ac0e@posting.google.com:

> Hello,
> 
> What are the differences between /bin, /usr/bin and /usr/local/bin? I
> dont understand how the binaries are sorted out in these three
> directories. If someone can clarify, i'd appreciate it.
> 

/bin contains tools required system to work (like 'ls', 'rm', 'mkdir' 
etc.)
which would be available at any time (for example if system crashes, they
were available in single user mode). Used by both root and lusers.

/usr/bin contains tools which are not needed in single user mode. Used
by both root and lusers.

/usr/local/bin is for local use - you install your binaries there. Used
by both root and lusers.


Please, take a look at Unix Filesystem Hierarchy specification, 
it explains everything about any directory.


P.Krumins
0
Reply Peteris 9/16/2003 7:42:07 PM

Andreas Kahari <ak+usenet@freeshell.org> wrote:

[SNIP]

> /usr/pkg instead of /usr/local.  Binaries in /bin on FreeBSD
> systems are dynamic (or I misunderstood something).

On my 4.8-STABLE there are only two binaries that are dynamic,
rmail (/bin) and mount_smbfs (/sbin).

HAND
Martin 

-- 
    .---------------.
    |   .-------.   |
    |---|   R   |---|     "Resistance is futile" 
    O   '-------'   O  (Michael Schoeberl in d.s.e) 
0
Reply Martin 9/16/2003 8:40:09 PM

# What are the differences between /bin, /usr/bin and /usr/local/bin? I

On some systems /usr is a mount point for a different device, so nothing under /usr
is available until the system is far enough along to do mounts. /bin and /lib contain
a minimum of what's necessary until the system can do mounts.

The magic, as it were, in unix is getting the kernel loaded and started and then
the first (init) process running; this happens early in the boot up. After that
it is doing normal unix with progressively more facilities as disks mount
and daemons start running.

--
Derk Gwen http://derkgwen.250free.com/html/index.html
I'm not even supposed to be here today.
0
Reply Derk 9/16/2003 8:56:58 PM

On 16 Sep 2003, gorda wrote:

> What are the differences between /bin, /usr/bin and /usr/local/bin? I

It depends which flavour of UNIX you're talking about.
On Solaris, /bin is a symbolic link to /usr/bin.

/usr/local/bin is, or rather, WAS, the dumping ground for
stuff that was locally compiled or developed.  System V
suggests the use of /opt for these "optional" packages
instead.

-- 
Rich Teer, SCNA, SCSA

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-online.net

0
Reply Rich 9/16/2003 10:48:39 PM

In article <jNZ9b.1122$jl7.431153335@news.nnrp.ca>, marko2 wrote:
> 
> "Martin Kaeske" <Martin.Kaeske@Stud.TU-Ilmenau.de> wrote in message
> news:bk7sf9$34v$1@hh59.t-link.de...
[cut]
>> On my 4.8-STABLE there are only two binaries that are dynamic,
>> rmail (/bin) and mount_smbfs (/sbin).
>>
> Explain dynamic in this situation, why is yours do different

Dynamic, as in dynamically linked.  An executable facilitating
the routines found in a shared library (*.so) file.  Not static.

The thing I said about FreeBSD having dynamic binaries in /bin
was a conclusion I got after reading a recent Slashdot story at
"http://bsd.slashdot.org/article.pl?sid=03/08/18/1517248".

-- 
Andreas K�h�ri
0
Reply Andreas 9/17/2003 2:27:22 PM

On Tue, 16 Sep 2003 22:48:39 GMT,
    Rich Teer <rich.teer@rite-group.com> wrote:


>On 16 Sep 2003, gorda wrote:
>
>> What are the differences between /bin, /usr/bin and /usr/local/bin? I
>
>It depends which flavour of UNIX you're talking about.
>On Solaris, /bin is a symbolic link to /usr/bin.
>
>/usr/local/bin is, or rather, WAS, the dumping ground for
>stuff that was locally compiled or developed.  System V
>suggests the use of /opt for these "optional" packages
>instead.
>

It though that /opt was for other packages you bought and /usr/local
for stuff you compiler locally.  /opt then contains a directory for
each vendor so there should be a fair chance they won't trample on
each other's files.


Villy
0
Reply vek 9/17/2003 2:34:31 PM

On 17 Sep 2003, Villy Kruse wrote:

> It though that /opt was for other packages you bought and /usr/local

Yes and no.  The former is true, but in System V, there's no
president for /usr/local.  One should consider everything
under /usr as "owned" by the OS.

/opt/local is probably the System V equivelent of /usr/local.

> for stuff you compiler locally.  /opt then contains a directory for
> each vendor so there should be a fair chance they won't trample on
> each other's files.

Yes, that's correct.  Or at least, a separate directory for
each package, which should be preceded by the vendor's
Nasdaq symbol, e.g., SUNWspro for Sun's developer tools.

-- 
Rich Teer, SCNA, SCSA

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-online.net

0
Reply Rich 9/17/2003 3:58:26 PM

In article <Pine.GSO.4.44.0309170855130.8206-100000@zaphod>, Rich Teer wrote:
> On 17 Sep 2003, Villy Kruse wrote:
> 
>> It though that /opt was for other packages you bought and /usr/local
> 
> Yes and no.  The former is true, but in System V, there's no
> president for /usr/local.  One should consider everything
> under /usr as "owned" by the OS.
> 
> /opt/local is probably the System V equivelent of /usr/local.

Since the packaging system on my OS keeps track of the
[3rd-party] software in /usr/local, I tend to perform
installations of non-packaged software in /opt/local.
GNU stow is great for doing this.

When it comes to 3rd-party/"local" and non-base-system software,
I think almost every OS (if not OS installation) does things
differently from one another.

-- 
Andreas K�h�ri
0
Reply Andreas 9/17/2003 4:19:12 PM

Andreas Kahari wrote:
> The thing I said about FreeBSD having dynamic binaries in /bin
> was a conclusion I got after reading a recent Slashdot story at
> "http://bsd.slashdot.org/article.pl?sid=03/08/18/1517248".

I think you didn't read far enough. The gist of what I read is that in 
all *existing* versions FreeBSD ships only static binaries in /bin. For 
the *upcoming* release an _option_ has been added allowing you to 
rebuild /bin in dynamic mode. This is said to be driven by the need of 
some embedded FreeBSD uses to get really small. In the responses to the 
article you cite there's a lot of misunderstanding, people thinking the 
default is going to change rather than just an option added.

Interestingly, the BSD traditionalists in that thread [*] are 
complaining about even the possibility of a dynamically-linked /bin 
while other Unices are moving in the opposite direction. For instance 
Sun has announced that there will be no static system libraries at all 
in the upcoming Solaris 10, and thus no possibility of a fully static 
binary (though static binaries built on older versions will presumably 
continue to work, and there's no reason you can't link statically with 
non-system libraries).

[*] Does anyone else remember when the two camps were SysV and BSD, and 
the SysV-ers were the traditionalists and BSD-ers were the irreverent 
young whippersnappers? Funny how they've morphed into the keepers of the 
flame while penguinistas fill their old role.

MB

0
Reply Mohun 9/17/2003 4:55:31 PM

"Martin Kaeske" <Martin.Kaeske@Stud.TU-Ilmenau.de> wrote in message
news:bk7sf9$34v$1@hh59.t-link.de...
> Andreas Kahari <ak+usenet@freeshell.org> wrote:
>
> [SNIP]
>
> > /usr/pkg instead of /usr/local.  Binaries in /bin on FreeBSD
> > systems are dynamic (or I misunderstood something).
>
> On my 4.8-STABLE there are only two binaries that are dynamic,
> rmail (/bin) and mount_smbfs (/sbin).
>
Explain dynamic in this situation, why is yours do different


0
Reply marko2 9/17/2003 5:01:16 PM

On Tue, 16 Sep 2003 19:37:14 +0000 (UTC)
Andreas Kahari <ak+usenet@freeshell.org> wrote:

> In article <87fbf9fb.0309161118.6f57ac0e@posting.google.com>, gorda wrote:
> > Hello,
> > 
> > What are the differences between /bin, /usr/bin and /usr/local/bin? I
> > dont understand how the binaries are sorted out in these three
> > directories. If someone can clarify, i'd appreciate it.
> 
> This differs between different Unix and Unix-like operating systems.
> 
> /bin
>     Statically linked essential (from admin point of view)
>     binaries on the / filesystem.  Should be available in case
>     of problem when one needs to boot into single user mode and
>     haven't got the other filesystems on-line yet.

Note that most (ie, every one I've used) has almost all binaries
dynamically linked:

~$ find {,/usr,/usr/local}/{s,}bin | xargs file | grep static
/sbin/sln:                               ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.4.0, statically linked, stripped
/sbin/ldconfig:                          ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.4.0, statically linked, stripped
/sbin/e2fsck:                            ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.4.0, statically linked, stripped
/bin/bash:                               ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.4.0, statically linked, stripped
/usr/bin/nc:                             ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.4.0, statically linked, stripped
/usr/bin/pkgadd:                         ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.4.0, statically linked, stripped

So basically, I'm in a whole load of trouble if any core library breaks. :)

This is CRUX Linux 1.1; It should be obvious why most of these are
statically linked. pkgadd is the package manager. netcat really
shouldn't (IMO) need to be statically linked, but a comment in the
Makefile gives a hint: "-Bstatic for sunos,  -static for gcc, etc.  You
want this, trust me."

Jason Creighton
0
Reply Jason 9/19/2003 6:53:24 PM

12 Replies
1904 Views

(page loaded in 0.152 seconds)

Similiar Articles:


















7/21/2012 7:14:03 PM


Reply: