The /bin Directory

/bin is a standard subdirectory of the root directory in Unix-like operating systems that contains the executable (i.e., ready to run) programs that must be available in order to attain minimal functionality for the purposes of booting (i.e., starting) and repairing a system.

The root directory, which is designated by a forward slash ( / ), is the top-level directory in the hierarchy of directories (also referred to as the directory tree) on Unix-like operating systems. That is, it is the directory that contains all other directories and their subdirectories as well as all files on the system.

A directory in a Unix-like operating system is merely a special type of file that contains a list of the names of objects (i.e., files, links and directories) that appear to the user to be in it along with the corresponding inodes for each object. A file is a named collection of related information that appears to the user as a single, contiguous block of data and that is retained in storage (e.g., a hard disk drive or a floppy disk). An inode is a data structure on a filesystem that stores all the information about a filesystem object except its name and its actual data. A data structure is a way of storing data so that it can be used efficiently. A filesystem is the hierarchy of directories that is used to organize files on a computer system.

The full names (also referred to as the absolute pathnames) of all of the subdirectories in the root directory begin with a forward slash, which shows their position in the filesystem hierarchy. In addition to /bin, some of the other standard subdirectories in the root directory include /boot, /dev, /etc, /home, /mnt, /usr, /proc and /var.

Among the contents of /bin are the shells (e.g., bash and csh), ls, grep, tar, kill, echo, ps, cp, mv, rm, cat, gzip, ping, su and the vi text editor. These programs can be used by both the root user (i.e., the administrative user) and ordinary users.

A list of all the programs in /bin can be viewed by using the ls command, which is commonly used to view the contents of directories, i.e.,

ls /bin

/bin is by default in PATH, which is the list of directories that the system searches for the corresponding program when a command is issued. This means that any executable file (i.e., runnable program) in /bin can be run just by entering the file name at the command line and then pressing the ENTER key. The contents of PATH can be seen by using the echo command as follows:

echo $PATH

There are several other directories on Unix-like systems that also contain the string (i.e., sequence of characters) bin in their names, including /sbin and /usr/bin. The former contains additional programs that are used to boot the system as well as administrative and system maintenance programs that are only available to the root user. The latter contains executable programs that are not required for booting or repairing the system.

Created June 5, 2005.
Copyright © 2005 The Linux Information Project. All Rights Reserved.