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