Difference between /bin and /usr/bin
What? no /bin/
is not a symlink to /usr/bin
on any FHS compliant system. Note that there are still popular Unices and Linuxes that ignore this - for example, /bin
and /sbin
are symlinked to /usr/bin
on Arch Linux (the reasoning being that you don't need /bin
for rescue/single-user-mode, since you'd just boot a live CD).
/bin
contains commands that may be used by both the system administrator and by users, but which are required when no other filesystems are mounted (e.g. in single user mode). It may also contain commands which are used indirectly by scripts
/usr/bin/
This is the primary directory of executable commands on the system.
essentially, /bin
contains executables which are required by the system for emergency repairs, booting, and single user mode. /usr/bin
contains any binaries that aren't required.
I will note, that they can be on separate disks/partitions, /bin
must be on the same disk as /
. /usr/bin
can be on another disk - although note that this configuration has been kind of broken for a while (this is why e.g. systemd warns about this configuration on boot).
For full correctness, some unices may ignore FHS, as I believe it is only a Linux Standard, I'm not aware that it has yet been included in SUS, Posix or any other UNIX standard, though it should be IMHO. It is a part of the LSB standard though.
Update: For some history and the real reason why there is /usr
, read this: http://lists.busybox.net/pipermail/busybox/2010-December/074114.html. Also this.
/sbin
- Binaries needed for booting, low-level system repair, or maintenance (run level 1 or S)
/bin
- Binaries needed for normal/standard system functioning at any run level.
/usr/bin
- Application/distribution binaries meant to be accessed by locally logged in users
/usr/sbin
- Application/distribution binaries that support or configure stuff in /sbin.
/usr/share/bin
- Application/distribution binaries or scripts meant to be accesed via the web, i.e. Apache web applications
*local*
- Binaries not part of a distribution; locally compiled or manually installed. There's usually never a /local/bin
but always a /usr/local/bin
and /usr/local/share/bin
.
Some kind of "update" on this issue:
Recently some Linux distributions are merging /bin
into /usr/bin
and relatedly /lib
into /usr/lib
. Sometimes also (/usr)/sbin
to /usr/bin
(Arch Linux).
So /usr
is expected to be available at the same time as /
.
The distinction between the two hierarchies is taken to be unnecessary complexity now.
The idea was once having only /bin
available at boot, but having an initial ramdisk makes this obsolete.
I know of Fedora Linux (2011) and Arch Linux (2012) going this way and Solaris is doing this for a long time (> 15 years).
- freedesktop: TheCaseForTheUsrMerge
- fedora: UsrMove feature
- arch: merge /bin, /sbin, /lib into /usr/bin and /usr/lib