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