next up previous contents
Next: The /usr/lib Directory Up: Directory Tree Overview Previous: Devices/dev

The Program Directories, /bin , /usr/bin , and Others

Programs in are usually scattered in many directories. The two most important ones are /bin and /usr/bin . Traditionally, all programs intended for the user (as opposed to the sysadmin) to run are in these directories. /bin

contains the stuff that is needed on the root partition, that is everything which is needed before /usr is mounted (assuming it is on a different partition), and also tools useful for recovering from disasters. /usr/bin contains most other things.

Usually /bin and /usr/bin contain programs that are part of the operating system, i.e. they are provided by the OS vendor, not by the user or a third party. Most systems have a place where locally written software, and freeware snarfed from Usenet or other places is installed. This is typically called /usr/local , with subdirectories bin , etc , lib , and man (and others as necessary). This way those programs are not in the way when a new version of the operating system is installed, especially since the upgrade procedure might wipe out all of /bin and /usr/bin . ( /usr/local would then preferably be either a mount point or a symbolic link so that it is not erased during the upgrade.)

In addition to these, many people prefer to install large packages in their own directories so that they can be easily uninstalled, and so that they don't have to worry about overwriting existing files from other packages when installing. It can also be nice to have all files that belong to a package in a central place. An example of this is that, on , X and X programs are usually installed to /usr/X386 , which is a similar directory tree to /usr/local . TeX and GNU Emacs are also usually installed this way on .

On some systemsgif with shared libraries, the directory /sbin holds statically linked versions of some of the most important programs. The intent is that if the shared library images become corrupt or are accidentally removed, it is still possible to fix things without having to boot. Typical binaries would be ln , cp , mount , and sync .

META:
check mail from geyer (1993-07-22) and SunOS

See section 3.5 for an example of how the shared libraries might become fouled up.

The drawback of /sbin is that statically linked binaries take a lot more disk space. When a binary of ln might be a couple of kilobytes when linked with shared libraries, it might be a couple of hundred kilobytes if linked statically. If you are willing to have to boot if you mess up your shared libraries---and have an emergency boot disk always available---it is never necessary to have /sbin . If you can't afford to boot, and you can afford the disk space, then /sbin is a very good idea. There is not, however, a single answer that is correct for everyone on this issue.

META:
hlu's sln is 320 bytes!



next up previous contents
Next: The /usr/lib Directory Up: Directory Tree Overview Previous: Devices/dev



Ross Biro
Mon May 22 09:14:56 PDT 1995