]> git.lizzy.rs Git - plan9front.git/blob - sys/man/1/0intro
/sys/man/*/*: fix perms (sorry)
[plan9front.git] / sys / man / 1 / 0intro
1 .TH INTRO 1
2 .SH NAME
3 intro \- introduction to Plan 9
4 .SH DESCRIPTION
5 Plan 9 is a distributed computing environment assembled from
6 separate machines acting as terminals,
7 CPU servers, and file servers.
8 A user works at a terminal, running a window system on a raster display.
9 Some windows are connected to CPU servers; the intent is that heavy computing
10 should be done in those windows but it is also possible to compute on the terminal.
11 A separate file server provides file storage for terminals and
12 CPU servers alike.
13 .SS Name Spaces
14 In Plan 9, almost all objects look like files.
15 The object retrieved by a given name is determined by a mapping called the
16 .IR "name space" .
17 A quick tour of the standard name space is in
18 .IR namespace (4).
19 Every program running in Plan 9 belongs to a
20 .I process group
21 (see
22 .I rfork
23 in
24 .IR fork (2)),
25 and the name space for each process group can be independently
26 customized.
27 .PP
28 A name space is hierarchically structured.
29 A full file name (also called a
30 .IR "full path name" )
31 has the form
32 .IP
33 .RI / e1 / e2 /.../ en
34 .PP
35 This represents an object in a tree of files: the tree has a root,
36 represented by the first
37 .LR / ;
38 the root has a child file named
39 .IR e1 ,
40 which in turn has child
41 .IR e2 ,
42 and so on; the descendent
43 .I en
44 is the object represented by the path name.
45 .PP
46 There are a number of Plan 9
47 .I services
48 available, each of which provides a tree of files.
49 A name space is built by
50 .I binding
51 services (or subtrees of services) to names in the name-space-so-far.
52 Typically, a user's home file server is bound to the root of the name space,
53 and other services are bound to conventionally named subdirectories.
54 For example, there is a service resident in the operating system for accessing
55 hardware devices and that is bound to
56 .B /dev
57 by convention.
58 Kernel services have names (outside the name space) that are a
59 .L #
60 sign followed by a single letter;
61 for example,
62 .B #c
63 is conventionally bound to
64 .BR /dev .
65 .PP
66 Plan 9 has
67 .IR "union directories" :
68 directories made of several directories all bound to the
69 same name.
70 The directories making up a union directory are ordered in a list.
71 When the bindings are made
72 (see
73 .IR bind (1)),
74 flags specify whether a newly bound member goes at the head or the tail of the list
75 or completely replaces the list.
76 To look up a name in a union directory, each member directory is searched
77 in list order until the name is found.
78 A bind
79 flag specifies whether file creation is allowed in a member directory:
80 a file created in the union directory goes in
81 the first member directory in list order that allows creation, if any.
82 .PP
83 The glue that holds Plan 9 together is a network protocol called
84 .IR 9P ,
85 described in section 5 of this manual.
86 All Plan 9 servers read and respond to 9P requests to navigate through
87 a file tree and to perform operations such as reading and writing
88 files within the tree.
89 .SS Booting
90 When a terminal is powered on or reset,
91 it must be told the name of a file server to boot from,
92 the operating system kernel to boot,
93 and a user name and password.
94 How this dialog proceeds is environment- and machine-dependent.
95 Once it is complete,
96 the terminal loads a Plan 9 kernel,
97 which sets some environment variables (see
98 .IR env (3))
99 and builds an initial name space.
100 See
101 .IR namespace (4),
102 .IR boot (8),
103 and
104 .IR init (8)
105 for details, but some important aspects of the initial name space are:
106 .IP \(bu
107 The environment variable
108 .B $cputype
109 is set to the name of the kernel's CPU's architecture: one of
110 .BR mips ,
111 .BR sparc ,
112 .B power
113 (Power PC),
114 .BR 386
115 (386, 486, Pentium, ...)
116 etc.
117 The environment variable
118 .B $objtype
119 is initially the same as
120 .BR $cputype .
121 .IP \(bu
122 The environment variable
123 .B $terminal
124 is set to a description of the machine running the kernel,
125 such as
126 .BR "generic pc" .
127 Sometimes the middle word of
128 .B $terminal
129 encodes the file from which the kernel is booted.
130 .IP \(bu
131 The environment variable
132 .B $service
133 is set to
134 .BR terminal .
135 (Other ways of accessing Plan 9 may set
136 .B $service
137 to one of
138 .BR cpu ,
139 .BR con ,
140 or
141 .BR rx .)
142 .IP \(bu
143 The environment variable
144 .B $user
145 is set to the name of the user who booted the terminal.
146 The environment variable
147 .B $home
148 is set to that user's home directory.
149 .IP \(bu
150 .B /$cputype/bin
151 and
152 .B /rc/bin
153 are unioned into
154 .BR /bin .
155 .PD
156 .PP
157 After booting, the terminal runs the command interpreter,
158 .IR rc (1),
159 on
160 .B /usr/$user/lib/profile
161 after moving to the user's home directory.
162 .PP
163 Here is a typical profile:
164 .IP
165 .EX
166 bind -a $home/bin/rc /bin
167 bind -a $home/bin/$cputype /bin
168 bind -c $home/tmp /tmp
169 font = /lib/font/bit/pelm/euro.9.font
170 upas/fs
171 switch($service){
172 case terminal
173         plumber
174         prompt=('term% ' '      ')
175         exec rio -f $font
176 case cpu
177         bind /mnt/term/dev/cons /dev/cons
178         bind /mnt/term/dev/consctl /dev/consctl
179         bind -a /mnt/term/mnt/wsys /dev
180         prompt=('cpu% ' '       ')
181         news
182 case con
183         prompt=('cpu% ' '       ')
184         news
185 }
186 .EE
187 .PD
188 .PP
189 The first three lines replace
190 .B /tmp
191 with a
192 .B tmp
193 in the user's home directory
194 and union personal
195 .B bin
196 directories with
197 .BR /bin ,
198 to be searched after the standard
199 .B bin
200 directories.
201 The next starts the mail file system; see
202 .IR mail (1).
203 Then different things happen, depending on the
204 .B $service
205 environment variable,
206 such as running the window system
207 .IR rio (1)
208 on a terminal.
209 .PP
210 To do heavy work such as compiling, the
211 .IR cpu (1)
212 command connects a window to a CPU server;
213 the same environment variables are set (to different values)
214 and the same profile is run.
215 The initial directory is the current directory in the terminal window
216 where
217 .I cpu
218 was typed.
219 The value of
220 .B $service
221 will be
222 .BR cpu ,
223 so the second arm of the profile switch is executed.
224 The root of the terminal's name space is accessible through
225 .BR /mnt/term ,
226 so the
227 .I bind
228 is a way of making the window system's graphics interface (see
229 .IR draw (3))
230 available to programs running on the CPU server.
231 The
232 .IR news (1)
233 command reports current Plan 9 affairs.
234 .PP
235 The third possible service type,
236 .BR con ,
237 is set when the CPU server is called from a non-Plan-9 machine,
238 such as through
239 .I telnet
240 (see
241 .IR con (1)).
242 .SS Using Plan 9
243 The user commands of Plan 9 are reminiscent of those in Research Unix, version 10.
244 There are a number of differences, however.
245 .PP
246 The standard shell is
247 .IR rc (1),
248 not the Bourne shell.
249 The most noticeable differences appear only when programming and macro processing.
250 .PP
251 The character-delete character is backspace, and the line-kill character is
252 control-U; these cannot be changed.
253 .PP
254 DEL is the interrupt character: typing it sends an interrupt to processes running in that window.
255 See
256 .IR keyboard (6)
257 for instructions on typing characters like DEL on the various keyboards.
258 .PP
259 If a program dies with something like an address error, it enters a `Broken'
260 state.  It lingers, available for debugging with
261 .IR db (1)
262 or
263 .IR acid (1).
264 .I Broke
265 (see
266 .IR kill (1))
267 cleans up broken processes.
268 .PP
269 The standard editor is one of
270 .IR acme (1)
271 or
272 .IR sam (1).
273 There is a variant of
274 .I sam
275 that permits running the file-manipulating part of
276 .I sam
277 on a non-Plan-9 system:
278 .IP
279 .EX
280 sam -r tcp!kremvax
281 .EE
282 .PP
283 For historical reasons,
284 .I sam
285 uses a tab stop setting of 8 spaces, while the other editors and window systems use 4 spaces.
286 These defaults can be overridden by setting the value of the environment variable
287 .B $tabstop
288 to the desired number of spaces per tab.
289 .PP
290 Machine names may be prefixed by the network name,
291 here
292 .BR tcp ;
293 and
294 .B net
295 for the system default.
296 .PP
297 Login connections and remote execution on non-Plan-9 machines are usually
298 done by saying, for example,
299 .IP
300 .EX
301 con kremvax
302 .EE
303 .PP
304 or
305 .IP
306 .EX
307 rx deepthought chess
308 .EE
309 .PP
310 (see
311 .IR con (1)).
312 .PP
313 .I 9fs 
314 connects to file systems of remote systems
315 (see
316 .IR srv (4)).
317 For example,
318 .IP
319 .EX
320 9fs kremvax
321 .EE
322 .PP
323 sets things up so that the root of
324 .BR kremvax 's
325 file tree is visible locally in
326 .BR /n/kremvax .
327 .PP
328 .IR Faces (1)
329 gives graphical notification of arriving mail.
330 .PP
331 The Plan 9 file server has an integrated backup facility.
332 The command
333 .IP
334 .EX
335 9fs dump
336 .EE
337 .PP
338 binds to
339 .B /n/dump
340 a tree containing the daily backups on the file server.
341 The dump tree has years as top level file names, and month-day
342 as next level file names.
343 For example,
344 .B /n/dump/2000/0120
345 is the root of the file system as it appeared at dump time on
346 January 20, 2000.
347 If more than one dump is taken on the same day, dumps after
348 the first have an extra digit.
349 To recover the version of this file as it was on June 15, 1999,
350 .IP
351 .EX
352 cp /n/dump/1999/0615/sys/man/1/0intro .
353 .EE
354 .PP
355 or use
356 .IR yesterday (1).
357 .SH SEE ALSO
358 This section for general publicly accessible commands.
359 .br
360 Section (2) for library functions, including system calls.
361 .br
362 Section (3) for kernel devices (accessed via
363 .IR bind (1)).
364 .br
365 Section (4) for file services (accessed via
366 .IR mount ).
367 .br
368 Section (5) for the Plan 9 file protocol.
369 .br
370 Section (6) for file formats.
371 .br
372 Section (7) for databases and database access programs.
373 .br
374 Section (8) for things related to administering Plan 9.
375 .br
376 .B /sys/doc
377 for copies of papers referenced in this manual.
378 .PP
379 The back of this volume has a permuted index to aid searches.
380 .SH DIAGNOSTICS
381 Upon termination each program returns a string called the
382 .IR "exit status" .
383 It was either supplied by a call to
384 .IR exits (2)
385 or was written to the command's
386 .BI /proc/ pid /note
387 file
388 (see
389 .IR proc (3)),
390 causing an abnormal termination.
391 The empty string is customary for successful execution;
392 a non-empty string gives a clue to the failure of the command.