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