intro – introduction to Plan 9
Plan 9 is a distributed computing environment assembled from separate
machines acting as terminals, CPU servers, and file servers. A
user works at a terminal, running a window system on a raster
display. Some windows are connected to CPU servers; the intent
is that heavy computing should be done in those
windows but it is also possible to compute on the terminal. A
separate file server provides file storage for terminals and CPU
A name space is hierarchically structured. A full file name (also
called a full path name) has the form
There are a number of Plan 9 services available, each of which provides a tree of files. A name space is built by binding services (or subtrees of services) to names in the name–space–so–far. Typically, a user's home file server is bound to the root of the name space, and other services are bound to conventionally named subdirectories. For example, there is a service resident in the operating system for accessing hardware devices and that is bound to /dev by convention. Kernel services have names (outside the name space) that are a # sign followed by a single letter; for example, #c is conventionally bound to /dev.
Plan 9 has union directories: directories made of several directories all bound to the same name. The directories making up a union directory are ordered in a list. When the bindings are made (see bind(1)), flags specify whether a newly bound member goes at the head or the tail of the list or completely replaces the list. To look up a name in a union directory, each member directory is searched in list order until the name is found. A bind flag specifies whether file creation is allowed in a member directory: a file created in the union directory goes in the first member directory in list order that allows creation, if any.
The glue that holds Plan 9 together is a network protocol called
9P, described in section 5 of this manual. All Plan 9 servers
read and respond to 9P requests to navigate through a file tree
and to perform operations such as reading and writing files within
After booting, the terminal runs the command interpreter, rc(1), on /usr/$user/lib/profile after moving to the user's home directory.
Here is a typical profile:
To do heavy work such as compiling, the cpu(1) command connects a window to a CPU server; the same environment variables are set (to different values) and the same profile is run. The initial directory is the current directory in the terminal window where cpu was typed. The value of $service will be cpu, so the second arm of the profile switch is executed. The root of the terminal's name space is accessible through /mnt/term, so the bind is a way of making the window system's graphics interface (see draw(3)) available to programs running on the CPU server. The news(1) command reports current Plan 9 affairs.
The third possible service type, con, is set when the CPU server
is called from a non–Plan–9 machine, such as through telnet (see
Using Plan 9
The standard shell is rc(1), not the Bourne shell. The most noticeable differences appear only when programming and macro processing.
The character–delete character is backspace, and the line–kill character is control–U; these cannot be changed.
DEL is the interrupt character: typing it sends an interrupt to processes running in that window. See keyboard(6) for instructions on typing characters like DEL on the various keyboards.
Machine names may be prefixed by the network name, here tcp; and net for the system default.
Login connections and remote execution on non–Plan–9 machines are
usually done by saying, for example,
9fs connects to file systems of remote systems (see srv(4)). For
Faces(1) gives graphical notification of arriving mail.
The Plan 9 file server has an integrated backup facility. The
This section for general publicly accessible commands.
Section (2) for library functions, including system calls.
Section (3) for kernel devices (accessed via bind(1)).
Section (4) for file services (accessed via mount).
Section (5) for the Plan 9 file protocol.
Section (6) for file formats.
Section (7) for databases and database access programs.
Section (8) for things related to administering Plan 9.
/sys/doc for copies of papers referenced in this manual.
The back of this volume has a permuted index to aid searches.
Upon termination each program returns a string called the exit
status. It was either supplied by a call to exits(2) or was written
to the command's /proc/pid/note file (see proc(3)), causing an
abnormal termination. The empty string is customary for successful
execution; a non–empty string gives a clue to the failure
of the command.