Initial import from FreeBSD RELENG_4:
[dragonfly.git] / bin / csh / USD.doc / csh.g
1 .\" Copyright (c) 1980, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)csh.g       8.1 (Berkeley) 6/8/93
33 .\" $FreeBSD: src/bin/csh/USD.doc/csh.g,v 1.5.2.2 2003/01/24 02:08:54 keramida Exp $
34 .\"
35 .SH
36 Glossary
37 .PP
38 This glossary lists the most important terms introduced in the
39 introduction to the
40 shell and gives references to sections of the shell
41 document for further information about them.
42 References of the form
43 `pr (1)'
44 indicate that the command
45 .I pr
46 is in the \s-2UNIX\s0 User Reference manual in section 1.
47 You can look at an online copy of its manual page by doing
48 .DS
49 man 1 pr
50 .DE
51 References of the form (2.5)
52 indicate that more information can be found in section 2.5 of this
53 manual.
54 .IP \&\fB.\fR 15n
55 Your current directory has the name `.' as well as the name printed
56 by the command
57 .I pwd;
58 see also
59 .I dirs.
60 The current directory `.' is usually the first
61 .I component
62 of the search path contained in the variable
63 .I path ,
64 thus commands which are in `.' are found first (2.2).
65 The character `.' is also used in separating
66 .I components
67 of filenames
68 (1.6).
69 The character `.' at the beginning of a
70 .I component
71 of a
72 .I pathname
73 is treated specially and not matched by the
74 .I "filename expansion"
75 metacharacters `?', `*', and `[' `]' pairs (1.6).
76 .IP \&\fB..\fR
77 Each directory has a file `..' in it which is a reference to its
78 parent directory.
79 After changing into the directory with
80 .I chdir ,
81 i.e.
82 .DS
83 chdir paper
84 .DE
85 you can return to the parent directory by doing
86 .DS
87 chdir ..
88 .DE
89 The current directory is printed by
90 .I pwd
91 (2.7).
92 .IP a.out
93 Compilers which create executable images create them, by default, in the
94 file
95 .I a.out.
96 for historical reasons (2.3).
97 .IP "absolute pathname"
98 .br
99 A
100 .I pathname
101 which begins with a `/' is
102 .I absolute
103 since it specifies the
104 .I path
105 of directories from the beginning
106 of the entire directory system \- called the
107 .I root
108 directory.
109 .I Pathname s
110 which are not
111 .I absolute
112 are called
113 .I relative
114 (see definition of
115 .I "relative pathname" )
116 (1.6).
117 .IP alias
118 An
119 .I alias
120 specifies a shorter or different name for a \s-2UNIX\s0
121 command, or a transformation on a command to be performed in
122 the shell.
123 The shell has a command
124 .I alias
125 which establishes
126 .I aliases
127 and can print their current values.
128 The command
129 .I unalias
130 is used to remove
131 .I aliases
132 (2.4).
133 .IP argument
134 Commands in \s-2UNIX\s0 receive a list of
135 .I argument
136 words.
137 Thus the command
138 .DS
139 echo a b c
140 .DE
141 consists of the
142 .I "command name"
143 `echo' and three
144 .I argument
145 words `a', `b' and `c'.
146 The set of
147 .I arguments
148 after the
149 .I "command name"
150 is said to be the
151 .I "argument list"
152 of the command (1.1).
153 .IP argv
154 The list of arguments to a command written in the shell language
155 (a shell script or shell procedure) is stored in a variable called
156 .I argv
157 within the shell.
158 This name is taken from the conventional name in the
159 C programming language (3.4).
160 .IP background
161 Commands started without waiting for them to complete are called
162 .I background
163 commands (2.6).
164 .IP base
165 A filename is sometimes thought of as consisting of a
166 .I base
167 part, before any `.' character, and an
168 .I extension
169 \- the part after
170 the `.'.  See
171 .I filename
172 and
173 .I extension
174 (1.6) and basename (1).
175 .IP bg
176 The
177 .I bg
178 command causes a
179 .I suspended
180 job to continue execution in the
181 .I background
182 (2.6).
183 .IP bin
184 A directory containing binaries of programs and shell scripts to be
185 executed is typically called a
186 .I bin
187 directory.
188 The standard system
189 .I bin
190 directories are `/bin' containing the most
191 heavily used commands and `/usr/bin' which contains most other user
192 programs.
193 Programs developed at UC Berkeley live in `/usr/ucb', while locally
194 written programs live in `/usr/local'.  Games are kept in the directory
195 `/usr/games'.
196 You can place binaries in any directory.
197 If you wish to execute them often, the name of the directories
198 should be a
199 .I component
200 of the variable
201 .I path .
202 .IP break
203 .I Break
204 is a builtin command used to exit from loops within the control
205 structure of the shell (3.7).
206 .IP breaksw
207 The
208 .I breaksw
209 builtin command is used to exit from a
210 .I switch
211 control structure, like a
212 .I break
213 exits from loops (3.7).
214 .IP builtin
215 A command executed directly by the shell is called a
216 .I builtin
217 command.
218 Most commands in \s-2UNIX\s0 are not built into the shell,
219 but rather exist as files in
220 .I bin
221 directories.
222 These commands are accessible because the directories in which
223 they reside are named in the
224 .I path
225 variable.
226 .IP case
227 A
228 .I case
229 command is used as a label in a
230 .I switch
231 statement in the shell's control structure, similar to that of the
232 language C.
233 Details are given in the shell documentation `csh (1)' (3.7).
234 .IP cat
235 The
236 .I cat
237 program catenates a list of specified files on the
238 .I "standard output" .
239 It is usually used to look at the contents of a single file on the terminal,
240 to `cat a file' (1.8, 2.3).
241 .IP cd
242 The
243 .I cd
244 command is used to change the
245 .I "working directory" .
246 With no arguments,
247 .I cd
248 changes your
249 .I "working directory"
250 to be your
251 .I home
252 directory (2.4, 2.7).
253 .IP chdir
254 The
255 .I chdir
256 command is a synonym for
257 .I cd .
258 .I Cd
259 is usually used because it is easier to type.
260 .IP chsh
261 The
262 .I chsh
263 command is used to change the shell which you use on \s-2UNIX\s0.
264 By default, you use a different version of the shell
265 which resides in `/bin/sh'.
266 You can change your shell to `/bin/csh' by doing
267 .DS
268 chsh your-login-name /bin/csh
269 .DE
270 Thus I would do
271 .DS
272 chsh bill /bin/csh
273 .DE
274 It is only necessary to do this once.
275 The next time you log in to \s-2UNIX\s0 after doing this command,
276 you will be using
277 .I csh
278 rather than the shell in `/bin/sh' (1.9).
279 .IP cmp
280 .I Cmp
281 is a program which compares files.
282 It is usually used on binary files, or to see if two files are identical (3.6).
283 For comparing text files the program
284 .I diff ,
285 described in `diff (1)' is used.
286 .IP command
287 A function performed by the system, either by the shell
288 (a builtin
289 .I command )
290 or by a program residing in a file in
291 a directory within the \s-2UNIX\s0 system, is called a
292 .I command
293 (1.1).
294 .IP "command name"
295 .br
296 When a command is issued, it consists of a
297 .I "command name" ,
298 which is the first word of the command,
299 followed by arguments.
300 The convention on \s-2UNIX\s0 is that the first word of a
301 command names the function to be performed (1.1).
302 .IP "command substitution"
303 .br
304 The replacement of a command enclosed in `\`' characters
305 by the text output by that command
306 is called
307 .I "command substitution"
308 (4.3).
309 .IP component
310 A part of a
311 .I pathname
312 between `/' characters is called a
313 .I component
314 of that
315 .I pathname .
316 A variable
317 which has multiple strings as value is said to have
318 several
319 .I component s;
320 each string is a
321 .I component
322 of the variable.
323 .IP continue
324 A builtin command which causes execution of the enclosing
325 .I foreach
326 or
327 .I while
328 loop to cycle prematurely.
329 Similar to the
330 .I continue
331 command in the programming language C (3.6).
332 .IP control-
333 Certain special characters, called
334 .I control
335 characters, are produced by holding down the \s-2CONTROL\s0 key
336 on your terminal and simultaneously pressing another character, much like
337 the \s-2SHIFT\s0 key is used to produce upper case characters. Thus
338 .I control- c
339 is produced by holding down the \s-2CONTROL\s0 key while pressing the
340 `c' key.  Usually \s-2UNIX\s0 prints a caret (^) followed by the
341 corresponding letter when you type a
342 .I control
343 character (e.g. `^C' for
344 .I control- c
345 (1.8).
346 .IP "core\ dump"
347 When a program terminates abnormally, the system places an image
348 of its current state in a file named `core'.
349 This
350 .I "core dump"
351 can be examined with the system debugger `adb (1)'
352 or `sdb (1)' in order to determine what went wrong with the program (1.8).
353 If the shell produces a message of the form
354 .DS
355 Illegal instruction (core dumped)
356 .DE
357 (where `Illegal instruction' is only one of several possible
358 messages), you should report this to the author of the program
359 or a system administrator,
360 saving the `core' file.
361 .IP cp
362 The
363 .I cp
364 (copy) program is used to copy the contents of one file into another
365 file.
366 It is one of the most commonly used \s-2UNIX\s0 commands (1.6).
367 .IP csh
368 The name of the shell
369 program that this document describes.
370 .IP \&.cshrc
371 The file
372 .I \&.cshrc
373 in your
374 .I home
375 directory is read by each shell as it begins execution.
376 It is usually used to change the setting of the variable
377 .I path
378 and to set
379 .I alias
380 parameters which are to take effect globally (2.1).
381 .IP cwd
382 The
383 .I cwd
384 variable in the shell holds the
385 .I "absolute pathname"
386 of the current
387 .I "working directory" \&.
388 It is changed by the shell whenever your current
389 .I "working directory"
390 changes and should not be changed otherwise (2.2).
391 .IP date
392 The
393 .I date
394 command prints the current date and time (1.3).
395 .IP debugging
396 .I Debugging
397 is the process of correcting mistakes in programs and shell scripts.
398 The shell has several options and variables which may be used
399 to aid in shell
400 .I debugging
401 (4.4).
402 .IP default:
403 The label
404 .I default:
405 is used within shell
406 .I switch
407 statements, as it is in the C language
408 to label the code to be executed if none of the
409 .I case
410 labels matches the value switched on (3.7).
411 .IP \s-2DELETE\s0
412 The
413 \s-2DELETE\s0
414 or
415 \s-2RUBOUT\s0
416 key on the terminal normally causes an interrupt to be sent to the current job.
417 Many users change the interrupt character to be ^C.
418 .IP detached
419 A command that continues running in the
420 .I background
421 after you logout is said to be
422 .I detached .
423 .IP diagnostic
424 An error message produced by a program is often referred to as a
425 .I diagnostic .
426 Most error messages are not written to the
427 .I "standard output" ,
428 since that is often directed away from the terminal (1.3, 1.5).
429 Error messsages are instead written to the
430 .I "diagnostic output"
431 which may be directed away from the terminal, but usually is not.
432 Thus
433 .I diagnostics
434 will usually appear on the terminal (2.5).
435 .IP directory
436 A structure which contains files.
437 At any time you are in one particular
438 .I directory
439 whose names can be printed by the command
440 .I pwd .
441 The
442 .I chdir
443 command will change you to another
444 .I directory ,
445 and make the files
446 in that
447 .I directory
448 visible. The
449 .I directory
450 in which you are when you first login is your
451 .I home
452 directory (1.1, 2.7).
453 .IP "directory\ stack"
454 The shell saves the names of previous
455 .I "working directories"
456 in the
457 .I "directory stack"
458 when you change your current
459 .I "working directory"
460 via the
461 .I pushd
462 command.  The
463 .I "directory stack"
464 can be printed by using the
465 .I dirs
466 command, which includes your current
467 .I "working directory"
468 as the first directory name on the left (2.7).
469 .IP dirs
470 The
471 .I dirs
472 command prints the shell's
473 .I "directory stack"
474 (2.7).
475 .IP du
476 The
477 .I du
478 command is a program (described in `du (1)') which
479 prints the number of disk blocks is all directories below
480 and including your current
481 .I "working directory"
482 (2.6).
483 .IP echo
484 The
485 .I echo
486 command prints its arguments (1.6, 3.6).
487 .IP else
488 The
489 .I else
490 command is part of the `if-then-else-endif' control
491 command construct (3.6).
492 .IP endif
493 If an
494 .I if
495 statement is ended with the word
496 .I then ,
497 all lines following the
498 .I if
499 up to a line starting with the word
500 .I endif
501 or
502 .I else
503 are executed if the condition between parentheses after the
504 .I if
505 is true (3.6).
506 .IP \s-2EOF\s0
507 An
508 .I "end\f1-\fPof\f1-\fPfile"
509 is generated by the terminal by a control-d,
510 and whenever a command reads to the end of a file which
511 it has been given as input.
512 Commands receiving input from a
513 .I pipe
514 receive an
515 .I "end\f1-\fPof\f1-\fPfile"
516 when the command sending them input completes.
517 Most commands terminate when they receive an
518 .I "end\f1-\fPof\f1-\fPfile" .
519 The shell has an option to ignore
520 .I "end\f1-\fPof\f1-\fPfile"
521 from a terminal
522 input which may help you keep from logging out accidentally
523 by typing too many control-d's (1.1, 1.8, 3.8).
524 .IP escape
525 A character `\e' used to prevent the special meaning of a metacharacter
526 is said to
527 .I escape
528 the character from its special meaning.
529 Thus
530 .DS
531 echo \e*
532 .DE
533 will echo the character `*' while just
534 .DS
535 echo *
536 .DE
537 will echo the names of the file in the current directory.
538 In this example, \e
539 .I escape s
540 `*' (1.7).
541 There is also a non-printing character called
542 .I escape ,
543 usually labelled
544 \s-2ESC\s0
545 or
546 \s-2ALTMODE\s0
547 on terminal keyboards.
548 Some older \s-2UNIX\s0 systems use this character to indicate that
549 output is to be
550 .I suspended .
551 Most systems use control-s to stop the output and control-q to start it.
552 .IP /etc/passwd
553 This file contains information about the accounts currently on the
554 system.
555 It consists of a line for each account with fields separated by
556 `:' characters (1.8).
557 You can look at this file by saying
558 .DS
559 cat /etc/passwd
560 .DE
561 The commands
562 .I finger
563 and
564 .I grep
565 are often used to search for information in this file.
566 See `finger (1)', `passwd(5)', and `grep (1)' for more details.
567 .IP exit
568 The
569 .I exit
570 command is used to force termination of a shell script,
571 and is built into the shell (3.9).
572 .IP "exit\ status"
573 A command which discovers a problem may reflect this back to the command
574 (such as a shell) which invoked (executed) it.
575 It does this by returning a non-zero number as its
576 .I "exit status" ,
577 a status of zero being considered
578 `normal termination'.
579 The
580 .I exit
581 command can be used to force a shell command script to give a non-zero
582 .I "exit status"
583 (3.6).
584 .IP expansion
585 The replacement of strings in the shell input which contain metacharacters
586 by other strings is referred to as the process of
587 .I expansion .
588 Thus the replacement of the word `*' by a sorted list of files
589 in the current directory is a `filename expansion'.
590 Similarly the replacement of the characters `!!' by the text of
591 the last command is a `history expansion'.
592 .I Expansions
593 are also referred to as
594 .I substitutions
595 (1.6, 3.4, 4.2).
596 .IP expressions
597 .I Expressions
598 are used in the shell
599 to control the conditional structures used in the writing of shell
600 scripts and in calculating values for these scripts.
601 The operators available in shell
602 .I expressions
603 are those of the language
604 C (3.5).
605 .IP extension
606 Filenames often consist of a
607 .I base
608 name and an
609 .I extension
610 separated by the character `.'.
611 By convention, groups of related files often share the same
612 .I root
613 name.
614 Thus if `prog.c' were a C program, then the object file for this
615 program would be stored in `prog.o'.
616 Similarly a paper written with the
617 `\-me'
618 nroff macro package might be stored in
619 `paper.me'
620 while a formatted version of this paper might be kept in
621 `paper.out' and a list of spelling errors in
622 `paper.errs' (1.6).
623 .IP fg
624 The
625 .I "job control"
626 command
627 .I fg
628 is used to run a
629 .I background
630 or
631 .I suspended
632 job in the
633 .I foreground
634 (1.8, 2.6).
635 .IP filename
636 Each file in \s-2UNIX\s0 has a name consisting of up to 14 characters
637 and not including the character `/' which is used in
638 .I pathname
639 building.  Most
640 .I filenames
641 do not begin with the character `.', and contain
642 only letters and digits with perhaps a `.' separating the
643 .I base
644 portion of the
645 .I filename
646 from an
647 .I extension
648 (1.6).
649 .IP "filename expansion"
650 .br
651 .I "Filename expansion"
652 uses the metacharacters `*', `?' and `[' and `]'
653 to provide a convenient mechanism for naming files.
654 Using
655 .I "filename expansion"
656 it is easy to name all the files in
657 the current directory, or all files which have a common
658 .I root
659 name. Other
660 .I "filename expansion"
661 mechanisms use the metacharacter `~' and allow
662 files in other users' directories to be named easily (1.6, 4.2).
663 .IP flag
664 Many \s-2UNIX\s0 commands accept arguments which are not the names
665 of files or other users but are used to modify the action of the commands.
666 These are referred to as
667 .I flag
668 options, and by convention consist of one or more letters preceded by
669 the character `\-' (1.2).
670 Thus the
671 .I ls
672 (list files) command has an option
673 `\-s' to list the sizes of files.
674 This is specified
675 .DS
676 ls \-s
677 .DE
678 .IP foreach
679 The
680 .I foreach
681 command is used in shell scripts and at the terminal to specify
682 repetition of a sequence of commands while the value of a certain
683 shell variable ranges through a specified list (3.6, 4.1).
684 .IP foreground
685 When commands are executing in the normal way such that the
686 shell is waiting for them to finish before prompting for another
687 command they are said to be
688 .I "foreground jobs"
689 or
690 .I "running in the foreground" \&.
691 This is as opposed to
692 .I background .
693 .I Foreground
694 jobs can be stopped by signals
695 from the terminal caused by typing different
696 control characters at the keyboard (1.8, 2.6).
697 .IP goto
698 The shell has a command
699 .I goto
700 used in shell scripts to transfer control to a given label (3.7).
701 .IP grep
702 The
703 .I grep
704 command searches through a list of argument files for a specified string.
705 Thus
706 .DS
707 grep bill /etc/passwd
708 .DE
709 will print each line in the file
710 .I "/etc/passwd"
711 which contains the string `bill'.
712 Actually,
713 .I grep
714 scans for
715 .I "regular expressions"
716 in the sense of the editors
717 `ed (1)' and `ex (1)'.
718 .I Grep
719 stands for
720 `globally find
721 .I "regular expression"
722 and print' (2.4).
723 .IP head
724 The
725 .I head
726 command prints the first few lines of one or more files.
727 If you have a bunch of files containing text which you are wondering
728 about it is sometimes useful to run
729 .I head
730 with these files as arguments.
731 This will usually show enough of what is in these files to let you decide
732 which you are interested in (1.5).
733 .br
734 .I Head
735 is also used to describe the part of a
736 .I pathname
737 before and including the last `/' character.  The
738 .I tail
739 of a
740 .I pathname
741 is the part after the last `/'.  The `:h' and `:t' modifiers allow the
742 .I head
743 or
744 .I tail
745 of a
746 .I pathname
747 stored in a shell variable to be used (3.6).
748 .IP history
749 The
750 .I history
751 mechanism of the shell allows previous commands to be repeated,
752 possibly after modification to correct typing mistakes or to change
753 the meaning of the command.
754 The shell has a
755 .I "history list"
756 where these commands are kept, and a
757 .I history
758 variable which controls how large this list is (2.3).
759 .IP "home\ directory"
760 .br
761 Each user has a
762 .I "home directory" ,
763 which is given in your entry
764 in the password file,
765 .I /etc/passwd .
766 This is the directory which you are placed in when you first login.
767 The
768 .I cd
769 or
770 .I chdir
771 command with no arguments takes you back to this directory, whose
772 name is recorded in the shell variable
773 .I home .
774 You can also access the
775 .I "home directories"
776 of other users in forming
777 filenames using a
778 .I "filename expansion"
779 notation and the character `~' (1.6).
780 .IP if
781 A conditional command within the shell, the
782 .I if
783 command is used in shell command scripts to make decisions
784 about what course of action to take next (3.6).
785 .IP ignoreeof
786 Normally, your shell will exit, printing
787 `logout'
788 if you type a control-d at a prompt of `% '.
789 This is the way you usually log off the system.
790 You can
791 .I set
792 the
793 .I ignoreeof
794 variable if you wish in your
795 .I \&.login
796 file and then use the command
797 .I logout
798 to logout.
799 This is useful if you sometimes accidentally type too many control-d
800 characters, logging yourself off
801 (2.2).
802 .IP input
803 Many commands on \s-2UNIX\s0 take information from the terminal or from
804 files which they then act on.
805 This information is called
806 .I input .
807 Commands normally read for
808 .I input
809 from their
810 .I "standard input"
811 which is, by default, the terminal.
812 This
813 .I "standard input"
814 can be redirected from a file using a shell metanotation
815 with the character `<'.
816 Many commands will also read from a file specified as argument.
817 Commands placed in
818 .I pipelines
819 will read from the output of the previous
820 command in the
821 .I pipeline .
822 The leftmost command in a
823 .I pipeline
824 reads from the terminal if
825 you neither redirect its
826 .I input
827 nor give it a filename to use as
828 .I "standard input" .
829 Special mechanisms exist for supplying input to commands in shell
830 scripts (1.5, 3.8).
831 .IP interrupt
832 An
833 .I interrupt
834 is a signal to a program that is generated by typing ^C. (On older versions
835 of UNIX the \s-2RUBOUT\s0 or \s-2DELETE\s0 key were used for this purpose.)
836 It causes most programs to stop execution.
837 Certain programs, such as the shell and the editors,
838 handle an
839 .I interrupt
840 in special ways, usually by stopping what they
841 are doing and prompting for another command.
842 While the shell is executing another command and waiting for it
843 to finish, the shell does not listen to
844 .I interrupts.
845 The shell often wakes up when you hit
846 .I interrupt
847 because many commands
848 die when they receive an
849 .I interrupt
850 (1.8, 3.9).
851 .IP job
852 One or more commands
853 typed on the same input line separated by `|' or `;' characters
854 are run together and are called a
855 .I job \&.
856 Simple commands run by themselves without any `|' or `;' characters
857 are the simplest
858 .I jobs.
859 .I Jobs
860 are classified as
861 .I foreground ,
862 .I background ,
863 or
864 .I suspended
865 (2.6).
866 .IP "job\ control"
867 The builtin functions that control the execution of
868 jobs are called
869 .I "job control"
870 commands.  These are
871 .I "bg, fg, stop, kill"
872 (2.6).
873 .IP "job\ number"
874 When each job
875 is started it is assigned a small number called a
876 .I "job number"
877 which is printed next to the job in the output of the
878 .I jobs
879 command.  This number, preceded by a `%' character, can be used as an argument
880 to
881 .I "job control"
882 commands to indicate
883 a specific job (2.6).
884 .IP jobs
885 The
886 .I jobs
887 command prints a table showing
888 jobs that are either running in the
889 .I background
890 or are
891 .I suspended
892 (2.6).
893 .IP kill
894 A command which sends a
895 signal
896 to a job causing it to terminate (2.6).
897 .IP \&.login
898 The file
899 .I \&.login
900 in your
901 .I home
902 directory is read by the shell each time you login to \s-2UNIX\s0
903 and the commands there are executed.
904 There are a number of commands which are usefully placed here,
905 especially
906 .I set
907 commands to the shell itself (2.1).
908 .IP "login\ shell"
909 The shell that is started on your terminal when you login is called
910 your
911 .I "login shell" .
912 It is different from other shells which you may run (e.g. on
913 shell scripts)
914 in that it reads the
915 .I \&.login
916 file before reading commands from the terminal and it reads the
917 .I \&.logout
918 file after you logout
919 (2.1).
920 .IP logout
921 The
922 .I logout
923 command causes a login shell to exit.
924 Normally, a login shell will exit when you hit control-d
925 generating an
926 .I end\f1-\fPof\f1-\fPfile,
927 but if you have set
928 .I ignoreeof
929 in you
930 .I \&.login
931 file then this will not work and you must use
932 .I logout
933 to log off the \s-2UNIX\s0 system (2.8).
934 .IP \&.logout
935 When you log off of \s-2UNIX\s0 the shell will execute commands from
936 the file
937 .I \&.logout
938 in your
939 .I home
940 directory after it prints `logout'.
941 .IP lpr
942 The command
943 .I lpr
944 is the line printer daemon.
945 The standard input of
946 .I lpr
947 spooled and printed on the \s-2UNIX\s0 line printer.
948 You can also give
949 .I lpr
950 a list of filenames as arguments to be printed.
951 It is most common to use
952 .I lpr
953 as the last component of a
954 .I pipeline
955 (2.3).
956 .IP ls
957 The
958 .I ls
959 (list files) command is one of the most commonly used \s-2UNIX\s0
960 commands.
961 With no argument filenames it prints the names of the files in the
962 current directory.
963 It has a number of useful
964 .I flag
965 arguments, and can also be given the names of directories
966 as arguments, in which case it lists the names of the files in these
967 directories (1.2).
968 .IP mail
969 The
970 .I mail
971 program is used to send and receive messages from other \s-2UNIX\s0
972 users (1.1, 2.1), whether they are logged on or not.
973 .IP make
974 The
975 .I make
976 command is used to maintain one or more related files and to
977 organize functions to be performed on these files.
978 In many ways
979 .I make
980 is easier to use, and more helpful than
981 shell command scripts (3.2).
982 .IP makefile
983 The file containing commands for
984 .I make
985 is called
986 .I makefile
987 or
988 .I Makefile
989 (3.2).
990 .IP manual
991 The
992 .I manual
993 often referred to is the
994 `\s-2UNIX\s0 manual'.
995 It contains 8 numbered sections with a description of each \s-2UNIX\s0
996 program (section 1), system call (section 2), subroutine (section 3),
997 device (section 4), special data structure (section 5), game (section 6),
998 miscellaneous item (section 7) and system administration program (section 8).
999 There are also supplementary documents (tutorials and reference guides)
1000 for individual programs which require explanation in more detail.
1001 An online version of the
1002 .I manual
1003 is accessible through the
1004 .I man
1005 command.
1006 Its documentation can be obtained online via
1007 .DS
1008 man man
1009 .DE
1010 If you can't decide what manual page to look in, try the
1011 .I apropos (1)
1012 command.
1013 The supplementary documents are in subdirectories of /usr/doc.
1014 .IP metacharacter
1015 .br
1016 Many characters which are neither letters nor digits have special meaning
1017 either to the shell or to \s-2UNIX\s0.
1018 These characters are called
1019 .I metacharacters .
1020 If it is necessary to place these characters in arguments to commands
1021 without them having their special meaning then they must be
1022 .I quoted .
1023 An example of a
1024 .I metacharacter
1025 is the character `>' which is used
1026 to indicate placement of output into a file.
1027 For the purposes of the
1028 .I history
1029 mechanism,
1030 most unquoted
1031 .I metacharacters
1032 form separate words (1.4).
1033 The appendix to this user's manual lists the
1034 .I metacharacters
1035 in groups by their function.
1036 .IP mkdir
1037 The
1038 .I mkdir
1039 command is used to create a new directory.
1040 .IP modifier
1041 Substitutions with the
1042 .I history
1043 mechanism, keyed by the character `!'
1044 or of variables using the metacharacter `$', are often subjected
1045 to modifications, indicated by placing the character `:' after the
1046 substitution and following this with the
1047 .I modifier
1048 itself.
1049 The
1050 .I "command substitution"
1051 mechanism can also be used to perform modification in a similar way,
1052 but this notation is less clear (3.6).
1053 .IP more
1054 The program
1055 .I more
1056 writes a file on your terminal allowing you to control how much text
1057 is displayed at a time.
1058 .I More
1059 can move through the file screenful by screenful, line by line,
1060 search forward for a string, or start again at the beginning of the file.
1061 It is generally the easiest way of viewing a file (1.8).
1062 .IP noclobber
1063 The shell has a variable
1064 .I noclobber
1065 which may be set in the file
1066 .I \&.login
1067 to prevent accidental destruction of files by the `>' output redirection
1068 metasyntax of the shell (2.2, 2.5).
1069 .IP noglob
1070 The shell variable
1071 .I noglob
1072 is set to suppress the
1073 .I "filename expansion"
1074 of arguments containing the metacharacters `~', `*', `?', `[' and `]' (3.6).
1075 .IP notify
1076 The
1077 .I notify
1078 command tells the shell to report on the termination of a specific
1079 .I "background job"
1080 at the exact time it occurs as opposed to waiting
1081 until just before the next prompt to report the termination.
1082 The
1083 .I notify
1084 variable, if set, causes the shell to always report the termination
1085 of
1086 .I background
1087 jobs exactly when they occur (2.6).
1088 .IP onintr
1089 The
1090 .I onintr
1091 command is built into the shell and is used to control the action
1092 of a shell command script when an
1093 .I interrupt
1094 signal is received (3.9).
1095 .IP output
1096 Many commands in \s-2UNIX\s0 result in some lines of text which are
1097 called their
1098 .I output.
1099 This
1100 .I output
1101 is usually placed on what is known as the
1102 .I "standard output"
1103 which is normally connected to the user's terminal.
1104 The shell has a syntax using the metacharacter `>' for redirecting
1105 the
1106 .I "standard output"
1107 of a command to a file (1.3).
1108 Using the
1109 .I pipe
1110 mechanism and the metacharacter `|' it is also possible for
1111 the
1112 .I "standard output"
1113 of one command to become the
1114 .I "standard input"
1115 of another command (1.5).
1116 Certain commands such as the line printer daemon
1117 .I p
1118 do not place their results on the
1119 .I "standard output"
1120 but rather in more
1121 useful places such as on the line printer (2.3).
1122 Similarly the
1123 .I write
1124 command places its output on another user's terminal rather than its
1125 .I "standard output"
1126 (2.3).
1127 Commands also have a
1128 .I "diagnostic output"
1129 where they write their error messages.
1130 Normally these go to the terminal even if the
1131 .I "standard output"
1132 has been sent to a file or another command, but it is possible
1133 to direct error diagnostics along with
1134 .I "standard output"
1135 using a special metanotation (2.5).
1136 .IP path
1137 The shell has a variable
1138 .I path
1139 which gives the names of the directories in which it searches for
1140 the commands which it is given.
1141 It always checks first to see if the command it is given is
1142 built into the shell.
1143 If it is, then it need not search for the command as it can do it internally.
1144 If the command is not builtin, then the shell searches for a file
1145 with the name given in each of the directories in the
1146 .I path
1147 variable, left to right.
1148 Since the normal definition of the
1149 .I path
1150 variable is
1151 .DS
1152 path    (. /usr/ucb /bin /usr/bin)
1153 .DE
1154 the shell normally looks in the current directory, and then in
1155 the standard system directories `/usr/ucb', `/bin' and `/usr/bin' for the named
1156 command (2.2).
1157 If the command cannot be found the shell will print an error diagnostic.
1158 Scripts of shell commands will be executed using another shell to interpret
1159 them if they have `execute' permission set.
1160 This is normally true because a command of the form
1161 .DS
1162 chmod 755 script
1163 .DE
1164 was executed to turn this execute permission on (3.3).
1165 If you add new commands to a directory in the
1166 .I path ,
1167 you should issue
1168 the command
1169 .I rehash
1170 (2.2).
1171 .IP pathname
1172 A list of names, separated by `/' characters, forms a
1173 .I pathname.
1174 Each
1175 .I component,
1176 between successive `/' characters, names a directory
1177 in which the next
1178 .I component
1179 file resides.
1180 .I Pathnames
1181 which begin with the character `/' are interpreted relative
1182 to the
1183 .I root
1184 directory in the file system.
1185 Other
1186 .I pathnames
1187 are interpreted relative to the current directory
1188 as reported by
1189 .I pwd.
1190 The last component of a
1191 .I pathname
1192 may name a directory, but
1193 usually names a file.
1194 .IP pipeline
1195 A group of commands which are connected together, the
1196 .I "standard output"
1197 of each connected to the
1198 .I "standard input"
1199 of the next,
1200 is called a
1201 .I pipeline.
1202 The
1203 .I pipe
1204 mechanism used to connect these commands is indicated by
1205 the shell metacharacter `|' (1.5, 2.3).
1206 .IP popd
1207 The
1208 .I popd
1209 command changes the shell's
1210 .I "working directory"
1211 to the directory you most recently left using the
1212 .I pushd
1213 command.  It returns to the directory without having to type its name,
1214 forgetting the name of the current
1215 .I "working directory"
1216 before doing so (2.7).
1217 .IP port
1218 The part of a computer system to which each terminal is
1219 connected is called a
1220 .I port .
1221 Usually the system has a fixed number of
1222 .I ports ,
1223 some of which are connected to telephone lines
1224 for dial-up access, and some of which are permanently
1225 wired directly to specific terminals.
1226 .IP pr
1227 The
1228 .I pr
1229 command is used to prepare listings of the contents of files
1230 with headers giving the name of the file and the date and
1231 time at which the file was last modified (2.3).
1232 .IP printenv
1233 The
1234 .I printenv
1235 command is used
1236 to print the current setting of variables in the environment
1237 (2.8).
1238 .IP process
1239 An instance of a running program is called a
1240 .I process
1241 (2.6).
1242 \s-2UNIX\s0 assigns each
1243 .I process
1244 a unique number when it is
1245 started \- called the
1246 .I "process number" .
1247 .I "Process numbers"
1248 can be used to stop individual
1249 .I processes
1250 using the
1251 .I kill
1252 or
1253 .I stop
1254 commands when the
1255 .I processes
1256 are part of a detached
1257 .I background
1258 job.
1259 .IP program
1260 Usually synonymous with
1261 .I command ;
1262 a binary file or shell command script
1263 which performs a useful function is often
1264 called a
1265 .I program .
1266 .IP prompt
1267 Many programs will print a
1268 .I prompt
1269 on the terminal when they expect input.
1270 Thus the editor
1271 `ex (1)' will print a `:' when it expects input.
1272 The shell
1273 .I prompts
1274 for input with `% ' and occasionally with `? ' when
1275 reading commands from the terminal (1.1).
1276 The shell has a variable
1277 .I prompt
1278 which may be set to a different value to change the shell's main
1279 .I prompt .
1280 This is mostly used when debugging the shell (2.8).
1281 .IP pushd
1282 The
1283 .I pushd
1284 command, which means `push directory', changes the shell's
1285 .I "working directory"
1286 and also remembers the current
1287 .I "working directory"
1288 before the change is made, allowing you to return to the same
1289 directory via the
1290 .I popd
1291 command later without retyping its name (2.7).
1292 .IP ps
1293 The
1294 .I ps
1295 command is used to show the processes you are currently running.
1296 Each process is shown with its unique process number,
1297 an indication of the terminal name it is attached to,
1298 an indication of the state of the process (whether it is running,
1299 stopped, awaiting some event (sleeping), and whether it is swapped out),
1300 and the amount of \s-2CPU\s0 time it has used so far.
1301 The command is identified by printing some of the words used
1302 when it was invoked (2.6).
1303 Shells, such as the
1304 .I csh
1305 you use to run the
1306 .I ps
1307 command, are not normally shown in the output.
1308 .IP pwd
1309 The
1310 .I pwd
1311 command prints the full
1312 .I pathname
1313 of the current
1314 .I "working directory" \&.
1315 The
1316 .I dirs
1317 builtin command is usually a better and faster choice.
1318 .IP quit
1319 The
1320 .I quit
1321 signal, generated by a control-\e,
1322 is used to terminate programs which are behaving unreasonably.
1323 It normally produces a core image file (1.8).
1324 .IP quotation
1325 The process by which metacharacters are prevented their special
1326 meaning, usually by using the character `\' in pairs, or by
1327 using the character `\e', is referred to as
1328 .I quotation
1329 (1.7).
1330 .IP redirection
1331 The routing of input or output from or to a file is known
1332 as
1333 .I redirection
1334 of input or output (1.3).
1335 .IP rehash
1336 The
1337 .I rehash
1338 command tells the shell to rebuild its internal table of which commands
1339 are found in which directories in your
1340 .I path .
1341 This is necessary when a new program is installed in one of these
1342 directories (2.8).
1343 .IP "relative pathname"
1344 .br
1345 A
1346 .I pathname
1347 which does not begin with a `/' is called a
1348 .I "relative pathname"
1349 since it is interpreted
1350 .I relative
1351 to the current
1352 .I "working directory" .
1353 The first
1354 .I component
1355 of such a
1356 .I pathname
1357 refers to some file or directory in the
1358 .I "working directory" ,
1359 and subsequent
1360 .I components
1361 between `/' characters refer to directories below the
1362 .I "working directory" .
1363 .I Pathnames
1364 that are not
1365 .I relative
1366 are called
1367 .I "absolute pathnames"
1368 (1.6).
1369 .IP repeat
1370 The
1371 .I repeat
1372 command iterates another command a specified number of times.
1373 .IP root
1374 The directory
1375 that is at the top of the entire directory structure is called the
1376 .I root
1377 directory since it is the `root' of the entire tree structure of
1378 directories.  The name used in
1379 .I pathnames
1380 to indicate the
1381 .I root
1382 is `/'.
1383 .I Pathnames
1384 starting with `/' are said to be
1385 .I absolute
1386 since they start at the
1387 .I root
1388 directory.
1389 .I Root
1390 is also used as the part of a
1391 .I pathname
1392 that is left after removing
1393 the
1394 .I extension .
1395 See
1396 .I filename
1397 for a further explanation (1.6).
1398 .IP \s-2RUBOUT\s0
1399 The \s-2RUBOUT\s0 or \s-2DELETE\s0
1400 key is often used to erase the previously typed character; some users
1401 prefer the \s-2BACKSPACE\s0 for this purpose.  On older versions of \s-2UNIX\s0
1402 this key served as the \s-2INTR\s0 character.
1403 .IP "scratch file"
1404 Files whose names begin with a `#' are referred to as
1405 .I "scratch files" ,
1406 since they are automatically removed by the system after a couple of
1407 days of non-use, or more frequently if disk space becomes tight (1.3).
1408 .IP script
1409 Sequences of shell commands placed in a file are called shell command
1410 .I scripts .
1411 It is often possible to perform simple tasks using these
1412 .I scripts
1413 without writing a program in a language such as C, by
1414 using the shell to selectively run other programs (3.3, 3.10).
1415 .IP set
1416 The builtin
1417 .I set
1418 command is used to assign new values to shell variables
1419 and to show the values of the current variables.
1420 Many shell variables have special meaning to the shell itself.
1421 Thus by using the
1422 .I set
1423 command the behavior of the shell can be affected (2.1).
1424 .IP setenv
1425 Variables in the environment `environ (5)'
1426 can be changed by using the
1427 .I setenv
1428 builtin command (2.8).
1429 The
1430 .I printenv
1431 command can be used to print the value of the variables in the environment.
1432 .IP shell
1433 A
1434 .I shell
1435 is a command language interpreter.
1436 It is possible to write and run your own
1437 .I shell ,
1438 as
1439 .I shells
1440 are no different than any other programs as far as the
1441 system is concerned.
1442 This manual deals with the details of one particular
1443 .I shell ,
1444 called
1445 .I csh.
1446 .IP "shell script"
1447 See
1448 .I script
1449 (3.3, 3.10).
1450 .IP signal
1451 A
1452 .I signal
1453 in \s-2UNIX\s0 is a short message that is sent to a running program
1454 which causes something to happen to that process.
1455 .I Signals
1456 are sent either by typing special
1457 .I control
1458 characters on the keyboard or by using the
1459 .I kill
1460 or
1461 .I stop
1462 commands (1.8, 2.6).
1463 .IP sort
1464 The
1465 .I sort
1466 program sorts a sequence of lines in ways that can be controlled
1467 by argument
1468 .I flags
1469 (1.5).
1470 .IP source
1471 The
1472 .I source
1473 command causes the shell to read commands from a specified file.
1474 It is most useful for reading files such as
1475 .I \&.cshrc
1476 after changing them (2.8).
1477 .IP "special character"
1478 .br
1479 See
1480 .I metacharacters
1481 and the
1482 appendix to this manual.
1483 .IP standard
1484 We refer often to the
1485 .I "standard input"
1486 and
1487 .I "standard output"
1488 of commands.
1489 See
1490 .I input
1491 and
1492 .I output
1493 (1.3, 3.8).
1494 .IP status
1495 A command normally returns a
1496 .I status
1497 when it finishes.
1498 By convention a
1499 .I status
1500 of zero indicates that the command succeeded.
1501 Commands may return non-zero
1502 .I status
1503 to indicate that some abnormal event has occurred.
1504 The shell variable
1505 .I status
1506 is set to the
1507 .I status
1508 returned by the last command.
1509 It is most useful in shell commmand scripts (3.6).
1510 .IP stop
1511 The
1512 .I stop
1513 command causes a
1514 .I background
1515 job to become
1516 .I suspended
1517 (2.6).
1518 .IP string
1519 A sequential group of characters taken together is called a
1520 .I string \&.
1521 .I Strings
1522 can contain any printable characters (2.2).
1523 .IP stty
1524 The
1525 .I stty
1526 program changes certain parameters inside \s-2UNIX\s0 which determine
1527 how your terminal is handled.  See `stty (1)' for a complete description (2.6).
1528 .IP substitution
1529 The shell implements a number of
1530 .I substitutions
1531 where sequences indicated by metacharacters are replaced by other sequences.
1532 Notable examples of this are history
1533 .I substitution
1534 keyed by the
1535 metacharacter `!' and variable
1536 .I substitution
1537 indicated by `$'.
1538 We also refer to
1539 .I substitutions
1540 as
1541 .I expansions
1542 (3.4).
1543 .IP suspended
1544 A job becomes
1545 .I suspended
1546 after a \s-2STOP\s0 signal is sent to it, either by typing a
1547 .I control -z
1548 at the terminal (for
1549 .I foreground
1550 jobs) or by using the
1551 .I stop
1552 command (for
1553 .I background
1554 jobs).  When
1555 .I suspended ,
1556 a job temporarily stops running until it is restarted by either the
1557 .I fg
1558 or
1559 .I bg
1560 command (2.6).
1561 .IP switch
1562 The
1563 .I switch
1564 command of the shell allows the shell
1565 to select one of a number of sequences of commands based on an
1566 argument string.
1567 It is similar to the
1568 .I switch
1569 statement in the language C (3.7).
1570 .IP termination
1571 When a command which is being executed finishes we say it undergoes
1572 .I termination
1573 or
1574 .I terminates.
1575 Commands normally terminate when they read an
1576 .I end\f1-\fPof\f1-\fPfile
1577 from their
1578 .I "standard input" .
1579 It is also possible to terminate commands by sending them
1580 an
1581 .I interrupt
1582 or
1583 .I quit
1584 signal (1.8).
1585 The
1586 .I kill
1587 program terminates specified jobs (2.6).
1588 .IP then
1589 The
1590 .I then
1591 command is part of the shell's
1592 `if-then-else-endif' control construct used in command scripts (3.6).
1593 .IP time
1594 The
1595 .I time
1596 command can be used to measure the amount of \s-2CPU\s0
1597 and real time consumed by a specified command as well
1598 as the amount of disk i/o, memory utilized, and number
1599 of page faults and swaps taken by the command (2.1, 2.8).
1600 .IP tset
1601 The
1602 .I tset
1603 program is used to set standard erase and kill characters
1604 and to tell the system what kind of terminal you are using.
1605 It is often invoked in a
1606 .I \&.login
1607 file (2.1).
1608 .IP tty
1609 The word
1610 .I tty
1611 is a historical abbreviation for `teletype' which is frequently used
1612 in \s-2UNIX\s0 to indicate the
1613 .I port
1614 to which a given terminal is connected.  The
1615 .I tty
1616 command will print the name of the
1617 .I tty
1618 or
1619 .I port
1620 to which your terminal is presently connected.
1621 .IP unalias
1622 The
1623 .I unalias
1624 command removes aliases (2.8).
1625 .IP \s-2UNIX\s0
1626 \s-2UNIX\s0 is an operating system on which
1627 .I csh
1628 runs.
1629 \s-2UNIX\s0 provides facilities which allow
1630 .I csh
1631 to invoke other programs such as editors and text formatters which
1632 you may wish to use.
1633 .IP unset
1634 The
1635 .I unset
1636 command removes the definitions of shell variables (2.2, 2.8).
1637 .IP "variable expansion"
1638 .br
1639 See
1640 .I variables
1641 and
1642 .I expansion
1643 (2.2, 3.4).
1644 .IP variables
1645 .I Variables
1646 in
1647 .I csh
1648 hold one or more strings as value.
1649 The most common use of
1650 .I variables
1651 is in controlling the behavior
1652 of the shell.
1653 See
1654 .I path ,
1655 .I noclobber ,
1656 and
1657 .I ignoreeof
1658 for examples.
1659 .I Variables
1660 such as
1661 .I argv
1662 are also used in writing shell programs (shell command scripts)
1663 (2.2).
1664 .IP verbose
1665 The
1666 .I verbose
1667 shell variable can be set to cause commands to be echoed
1668 after they are history expanded.
1669 This is often useful in debugging shell scripts.
1670 The
1671 .I verbose
1672 variable is set by the shell's
1673 .I \-v
1674 command line option (3.10).
1675 .IP wc
1676 The
1677 .I wc
1678 program calculates the number of characters, words, and lines in the
1679 files whose names are given as arguments (2.6).
1680 .IP while
1681 The
1682 .I while
1683 builtin control construct is used in shell command scripts (3.7).
1684 .IP word
1685 A sequence of characters which forms an argument to a command is called
1686 a
1687 .I word .
1688 Many characters which are neither letters, digits, `\-', `.' nor `/'
1689 form
1690 .I words
1691 all by themselves even if they are not surrounded
1692 by blanks.
1693 Any sequence of characters may be made into a
1694 .I word
1695 by surrounding it
1696 with `\'' characters
1697 except for the characters `\'' and `!' which require special treatment
1698 (1.1).
1699 This process of placing special characters in
1700 .I words
1701 without their special meaning is called
1702 .I quoting .
1703 .IP "working directory"
1704 .br
1705 At any given time you are in one particular directory, called
1706 your
1707 .I "working directory" .
1708 This directory's name is printed by the
1709 .I pwd
1710 command and the files listed by
1711 .I ls
1712 are the ones in this directory.
1713 You can change
1714 .I "working directories"
1715 using
1716 .I chdir .
1717 .IP write
1718 The
1719 .I write
1720 command is an obsolete way of communicating with other users who are logged in to
1721 \s-2UNIX\s0 (you have to take turns typing).  If you are both using display
1722 terminals, use \fItalk\fP(1), which is much more pleasant.