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