Index: head/bin/getfacl/getfacl.1 =================================================================== --- head/bin/getfacl/getfacl.1 (revision 162378) +++ head/bin/getfacl/getfacl.1 (revision 162379) @@ -1,120 +1,121 @@ .\"- .\" Copyright (c) 2000, 2001, 2002 Robert N. M. Watson .\" All rights reserved. .\" .\" This software was developed by Robert Watson for the TrustedBSD Project. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .\" Developed by the TrustedBSD Project. .\" Support for POSIX.1e access control lists. .\" -.Dd December 30, 2002 +.Dd March 13, 2006 .Dt GETFACL 1 .Os .Sh NAME .Nm getfacl .Nd get ACL information .Sh SYNOPSIS .Nm .Op Fl dhq .Op Ar .Sh DESCRIPTION The .Nm utility writes discretionary access control information associated with the specified file(s) to standard output. If the .Xr getconf 1 utility indicates that .Eq { } Va _POSIX_ACL_EXTENDED is not in effect for a .Ar file then the standard discretionary access permissions are interpreted as an ACL containing only the required ACL entries. .Pp The following option is available: .Bl -tag -width indent .It Fl d The operation applies to the default ACL of a directory instead of the access ACL. An error is generated if a default ACL cannot be associated with .Ar file . .It Fl h If the target of the operation is a symbolic link, return the ACL from the symbolic link itself rather than following the link. .It Fl q -Don't write commented information about file name and ownership. This is +Do not write commented information about file name and ownership. +This is useful when dealing with filenames with unprintable characters. .El .Pp The following operand is available: .Bl -tag -width indent .It Ar file A pathname of a file whose ACL shall be retrieved. If .Ar file is not specified, or a .Ar file is specified as .Fl , then .Nm reads a list of pathnames, each terminated by one newline character, from the standard input. .El .Sh EXIT STATUS .Ex -std .Sh EXAMPLES .Dl getfacl / .Pp Retrieve ACL for the directory .Pa / . .Pp .Dl getfacl -d / .Pp Retrieve the default ACL for the directory .Pa / , if any. .Sh SEE ALSO .Xr setfacl 1 , .Xr acl 3 , .Xr getextattr 8 , .Xr setextattr 8 , .Xr acl 9 , .Xr extattr 9 .Sh STANDARDS The .Nm utility is expected to be .Tn IEEE Std 1003.2c compliant. .Sh HISTORY Extended Attribute and Access Control List support was developed as part of the .Tn TrustedBSD Project and introduced in .Fx 5.0 . .Sh AUTHORS .An Robert N M Watson Index: head/bin/ls/ls.1 =================================================================== --- head/bin/ls/ls.1 (revision 162378) +++ head/bin/ls/ls.1 (revision 162379) @@ -1,690 +1,690 @@ .\"- .\" Copyright (c) 1980, 1990, 1991, 1993, 1994 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" the Institute of Electrical and Electronics Engineers, Inc. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)ls.1 8.7 (Berkeley) 7/29/94 .\" $FreeBSD$ .\" -.Dd November 16, 2005 +.Dd March 24, 2006 .Dt LS 1 .Os .Sh NAME .Nm ls .Nd list directory contents .Sh SYNOPSIS .Nm .Op Fl ABCFGHILPRSTUWZabcdfghiklmnopqrstuwx1 .Op Ar .Sh DESCRIPTION For each operand that names a .Ar file of a type other than directory, .Nm displays its name as well as any requested, associated information. For each operand that names a .Ar file of type directory, .Nm displays the names of files contained within that directory, as well as any requested, associated information. .Pp If no operands are given, the contents of the current directory are displayed. If more than one operand is given, non-directory operands are displayed first; directory and non-directory operands are sorted separately and in lexicographical order. .Pp The following options are available: .Bl -tag -width indent .It Fl A List all entries except for .Pa \&. and .Pa .. . Automatically set for the super-user unless .Fl I is specified. .It Fl B Force printing of non-printable characters (as defined by .Xr ctype 3 and current locale settings) in file names as .Li \e Ns Va xxx , where .Va xxx is the numeric value of the character in octal. .It Fl C Force multi-column output; this is the default when output is to a terminal. .It Fl F Display a slash .Pq Ql / immediately after each pathname that is a directory, an asterisk .Pq Ql * after each that is executable, an at sign .Pq Ql @ after each symbolic link, an equals sign .Pq Ql = after each socket, a percent sign .Pq Ql % after each whiteout, and a vertical bar .Pq Ql \&| after each that is a .Tn FIFO . .It Fl G Enable colorized output. This option is equivalent to defining .Ev CLICOLOR in the environment. (See below.) .It Fl H Symbolic links on the command line are followed. This option is assumed if none of the .Fl F , d , or .Fl l options are specified. .It Fl I Prevent .Fl A from being automatically set for the super-user. .It Fl L If argument is a symbolic link, list the file or directory the link references rather than the link itself. This option cancels the .Fl P option. .It Fl P If argument is a symbolic link, list the link itself rather than the object the link references. This option cancels the .Fl H and .Fl L options. .It Fl R Recursively list subdirectories encountered. .It Fl S Sort by size (largest file first) before sorting the operands in lexicographical order. .It Fl T When used with the .Fl l (lowercase letter .Dq ell ) option, display complete time information for the file, including month, day, hour, minute, second, and year. .It Fl U Use time when file was created for sorting or printing. .It Fl W Display whiteouts when scanning directories. .It Fl Z Display each file's MAC label; see .Xr maclabel 7 . .It Fl a Include directory entries whose names begin with a dot .Pq Pa \&. . .It Fl b As .Fl B , but use .Tn C escape codes whenever possible. .It Fl c Use time when file status was last changed for sorting or printing. .It Fl d Directories are listed as plain files (not searched recursively). .It Fl f Output is not sorted. .It Fl g This option is deprecated and is only available for compatibility with .Bx 4.3 ; it was used to display the group name in the long .Pq Fl l format output. .It Fl h When used with the .Fl l option, use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte in order to reduce the number of digits to four or fewer using base 2 for sizes. .It Fl i For each file, print the file's file serial number (inode number). .It Fl k This has the same effect as setting environment variable .Ev BLOCKSIZE to 1024, except that it also nullifies any .Fl h options to its left. .It Fl l (The lowercase letter .Dq ell . ) List files in the long format, as described in the .Sx The Long Format subsection below. .It Fl m Stream output format; list files across the page, separated by commas. .It Fl n Display user and group IDs numerically rather than converting to a user or group name in a long .Pq Fl l output. .It Fl o Include the file flags in a long .Pq Fl l output. .It Fl p Write a slash .Pq Ql / after each filename if that file is a directory. .It Fl q Force printing of non-graphic characters in file names as the character .Ql \&? ; this is the default when output is to a terminal. .It Fl r Reverse the order of the sort. .It Fl s Display the number of blocks used in the file system by each file. Block sizes and directory totals are handled as described in .Sx The Long Format subsection below, except (if the long format is not also requested) the directory totals are not output when the output is in a single column, even if multi-column output is requested. .It Fl t Sort by time modified (most recently modified first) before sorting the operands in lexicographical order. .It Fl u Use time of last access, instead of last modification of the file for sorting .Pq Fl t or printing .Pq Fl l . .It Fl w Force raw printing of non-printable characters. This is the default when output is not to a terminal. .It Fl x The same as .Fl C , except that the multi-column output is produced with entries sorted across, rather than down, the columns. .It Fl 1 (The numeric digit .Dq one . ) Force output to be one entry per line. This is the default when output is not to a terminal. .El .Pp The .Fl 1 , C , x , and .Fl l options all override each other; the last one specified determines the format used. .Pp The .Fl c , u , and .Fl U options all override each other; the last one specified determines the file time used. .Pp The .Fl S and .Fl t options override each other; the last one specified determines the sort order used. .Pp The .Fl B , b , w , and .Fl q options all override each other; the last one specified determines the format used for non-printable characters. .Pp The .Fl H , L and .Fl P options all override each other (either partially or fully); they are applied in the order specified. .Pp By default, .Nm lists one entry per line to standard output; the exceptions are to terminals or when the .Fl C or .Fl x options are specified. .Pp File information is displayed with one or more .Ao blank Ac Ns s separating the information associated with the .Fl i , s , and .Fl l options. .Ss The Long Format If the .Fl l option is given, the following information is displayed for each file: file mode, number of links, owner name, group name, MAC label, number of bytes in the file, abbreviated month, day-of-month file was last modified, hour file last modified, minute file last modified, and the pathname. .Pp If the modification time of the file is more than 6 months in the past or future, then the year of the last modification is displayed in place of the hour and minute fields. .Pp If the owner or group names are not a known user or group name, or the .Fl n option is given, the numeric ID's are displayed. .Pp If the file is a character special or block special file, the major and minor device numbers for the file are displayed in the size field. If the file is a symbolic link the pathname of the linked-to file is preceded by .Dq Li -> . .Pp The listing of a directory's contents is preceded by a labeled total number of blocks used in the file system by the files which are listed as the directory's contents (which may or may not include .Pa \&. and .Pa .. and other files which start with a dot, depending on other options). .Pp The default block size is 512 bytes. The block size may be set with option .Fl k or environment variable .Ev BLOCKSIZE . Numbers of blocks in the output will have been rounded up so the numbers of bytes is at least as many as used by the corresponding file system blocks (which might have a different size). .Pp The file mode printed under the .Fl l option consists of the entry type and the permissions. The entry type character describes the type of file, as follows: .Pp .Bl -tag -width 4n -offset indent -compact .It Sy b Block special file. .It Sy c Character special file. .It Sy d Directory. .It Sy l Symbolic link. .It Sy s Socket link. .It Sy p .Tn FIFO . .It Sy \- Regular file. .El .Pp The next three fields are three characters each: owner permissions, group permissions, and other permissions. Each field has three character positions: .Bl -enum -offset indent .It If .Sy r , the file is readable; if .Sy \- , it is not readable. .It If .Sy w , the file is writable; if .Sy \- , it is not writable. .It The first of the following that applies: .Bl -tag -width 4n -offset indent .It Sy S If in the owner permissions, the file is not executable and set-user-ID mode is set. If in the group permissions, the file is not executable and set-group-ID mode is set. .It Sy s If in the owner permissions, the file is executable and set-user-ID mode is set. If in the group permissions, the file is executable and setgroup-ID mode is set. .It Sy x The file is executable or the directory is searchable. .It Sy \- The file is neither readable, writable, executable, nor set-user-ID nor set-group-ID mode, nor sticky. (See below.) .El .Pp These next two apply only to the third character in the last group (other permissions). .Bl -tag -width 4n -offset indent .It Sy T The sticky bit is set (mode .Li 1000 ) , but not execute or search permission. (See .Xr chmod 1 or .Xr sticky 8 . ) .It Sy t The sticky bit is set (mode .Li 1000 ) , and is searchable or executable. (See .Xr chmod 1 or .Xr sticky 8 . ) .El .El .Pp The next field contains a plus .Pq Ql + character if the file has an ACL, or a space .Pq Ql " " if it does not. The .Nm utility does not show the actual ACL; use .Xr getfacl 1 to do this. .Sh ENVIRONMENT The following environment variables affect the execution of .Nm : .Bl -tag -width ".Ev CLICOLOR_FORCE" .It Ev BLOCKSIZE If this is set, its value, rounded up to 512 or down to a multiple of 512, will be used as the block size in bytes by the .Fl l and .Fl s options. See .Sx The Long Format subsection for more information. .It Ev CLICOLOR Use .Tn ANSI color sequences to distinguish file types. See .Ev LSCOLORS below. In addition to the file types mentioned in the .Fl F option some extra attributes (setuid bit set, etc.) are also displayed. The colorization is dependent on a terminal type with the proper .Xr termcap 5 capabilities. The default .Dq Li cons25 console has the proper capabilities, but to display the colors in an .Xr xterm 1 , for example, the .Ev TERM variable must be set to .Dq Li xterm-color . Other terminal types may require similar adjustments. Colorization is silently disabled if the output is not directed to a terminal unless the .Ev CLICOLOR_FORCE variable is defined. .It Ev CLICOLOR_FORCE Color sequences are normally disabled if the output is not directed to a terminal. This can be overridden by setting this flag. The .Ev TERM variable still needs to reference a color capable terminal however otherwise it is not possible to determine which color sequences to use. .It Ev COLUMNS If this variable contains a string representing a decimal integer, it is used as the column position width for displaying multiple-text-column output. The .Nm utility calculates how many pathname text columns to display based on the width provided. (See .Fl C and .Fl x . ) .It Ev LANG The locale to use when determining the order of day and month in the long .Fl l format output. See .Xr environ 7 for more information. .It Ev LSCOLORS The value of this variable describes what color to use for which attribute when colors are enabled with .Ev CLICOLOR . This string is a concatenation of pairs of the format .Ar f Ns Ar b , where .Ar f is the foreground color and .Ar b is the background color. .Pp The color designators are as follows: .Pp .Bl -tag -width 4n -offset indent -compact .It Sy a black .It Sy b red .It Sy c green .It Sy d brown .It Sy e blue .It Sy f magenta .It Sy g cyan .It Sy h light grey .It Sy A bold black, usually shows up as dark grey .It Sy B bold red .It Sy C bold green .It Sy D bold brown, usually shows up as yellow .It Sy E bold blue .It Sy F bold magenta .It Sy G bold cyan .It Sy H bold light grey; looks like bright white .It Sy x default foreground or background .El .Pp Note that the above are standard .Tn ANSI colors. The actual display may differ depending on the color capabilities of the terminal in use. .Pp The order of the attributes are as follows: .Pp .Bl -enum -offset indent -compact .It directory .It symbolic link .It socket .It pipe .It executable .It block special .It character special .It executable with setuid bit set .It executable with setgid bit set .It directory writable to others, with sticky bit .It directory writable to others, without sticky bit .El .Pp The default is .Qq "exfxcxdxbxegedabagacad" , i.e., blue foreground and default background for regular directories, black foreground and red background for setuid executables, etc. .It Ev LS_COLWIDTHS If this variable is set, it is considered to be a colon-delimited list of minimum column widths. Unreasonable and insufficient widths are ignored (thus zero signifies a dynamically sized column). Not all columns have changeable widths. The fields are, in order: inode, block count, number of links, user name, group name, flags, file size, file name. .It Ev TERM The .Ev CLICOLOR functionality depends on a terminal type with color capabilities. .It Ev TZ The timezone to use when displaying dates. See .Xr environ 7 for more information. .El .Sh EXIT STATUS .Ex -std .Sh COMPATIBILITY The group field is now automatically included in the long listing for files in order to be compatible with the .St -p1003.2 specification. .Sh SEE ALSO .Xr chflags 1 , .Xr chmod 1 , .Xr getfacl 1 , .Xr sort 1 , .Xr xterm 1 , .Xr termcap 5 , .Xr maclabel 7 , .Xr symlink 7 , .Xr getfmac 8 , .Xr sticky 8 .Sh STANDARDS With the exception of options .Fl I , g , n and .Fl o , the .Nm utility conforms to .St -p1003.1-2001 . .Pp The ACL support is compatible with .Tn IEEE Std\~1003.2c .Pq Dq Tn POSIX Ns .2c Draft\~17 (withdrawn). .Sh HISTORY An .Nm command appeared in .At v1 . .Sh BUGS To maintain backward compatibility, the relationships between the many options are quite complex. .Pp The exception mentioned in the .Fl s option description might be a feature that was based on the fact that single-column output usually goes to something other than a terminal. It is debatable whether this is a design bug. Index: head/bin/pax/pax.1 =================================================================== --- head/bin/pax/pax.1 (revision 162378) +++ head/bin/pax/pax.1 (revision 162379) @@ -1,1194 +1,1195 @@ .\"- .\" Copyright (c) 1992 Keith Muller. .\" Copyright (c) 1992, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" Keith Muller of the University of California, San Diego. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)pax.1 8.4 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" .Dd July 3, 2004 .Dt PAX 1 .Os .Sh NAME .Nm pax .Nd read and write file archives and copy directory hierarchies .Sh SYNOPSIS .Nm .Op Fl cdnvz .Bk -words .Op Fl f Ar archive .Ek .Bk -words .Op Fl s Ar replstr .Ar ...\& .Ek .Bk -words .Op Fl U Ar user .Ar ...\& .Ek .Bk -words .Op Fl G Ar group .Ar ...\& .Ek .Bk -words .Oo .Fl T .Op Ar from_date .Op Ar ,to_date .Oc .Ar ...\& .Ek .Op Ar pattern ...\& .Nm .Fl r .Op Fl cdiknuvzDYZ .Bk -words .Op Fl f Ar archive .Ek .Bk -words .Op Fl o Ar options .Ar ...\& .Ek .Bk -words .Op Fl p Ar string .Ar ...\& .Ek .Bk -words .Op Fl s Ar replstr .Ar ...\& .Ek .Op Fl E Ar limit .Bk -words .Op Fl U Ar user .Ar ...\& .Ek .Bk -words .Op Fl G Ar group .Ar ...\& .Ek .Bk -words .Oo .Fl T .Op Ar from_date .Op Ar ,to_date .Oc .Ar ...\& .Ek .Op Ar pattern ...\& .Nm .Fl w .Op Fl dituvzHLPX .Bk -words .Op Fl b Ar blocksize .Ek .Oo .Op Fl a .Op Fl f Ar archive .Oc .Bk -words .Op Fl x Ar format .Ek .Bk -words .Op Fl s Ar replstr .Ar ...\& .Ek .Bk -words .Op Fl o Ar options .Ar ...\& .Ek .Bk -words .Op Fl U Ar user .Ar ...\& .Ek .Bk -words .Op Fl G Ar group .Ar ...\& .Ek .Bk -words .Op Fl B Ar bytes .Ek .Bk -words .Oo .Fl T .Op Ar from_date .Op Ar ,to_date .Op Ar /[c][m] .Oc .Ar ...\& .Ek .Op Ar .Nm .Fl r .Fl w .Op Fl diklntuvDHLPXYZ .Bk -words .Op Fl p Ar string .Ar ...\& .Ek .Bk -words .Op Fl s Ar replstr .Ar ...\& .Ek .Bk -words .Op Fl U Ar user .Ar ...\& .Ek .Bk -words .Op Fl G Ar group .Ar ...\& .Ek .Bk -words .Oo .Fl T .Op Ar from_date .Op Ar ,to_date .Op Ar /[c][m] .Oc .Ar ...\& .Ek .Op Ar .Ar directory .Sh DESCRIPTION The .Nm utility will read, write, and list the members of an archive file, and will copy directory hierarchies. These operations are independent of the specific archive format, and support a wide variety of different archive formats. A list of supported archive formats can be found under the description of the .Fl x option. .Pp The presence of the .Fl r and the .Fl w options specifies which of the following functional modes .Nm will operate under: .Em list , read , write , and .Em copy . .Bl -tag -width 6n .It .Em List . Write to .Dv standard output a table of contents of the members of the archive file read from .Dv standard input , whose pathnames match the specified .Ar patterns . The table of contents contains one filename per line and is written using single line buffering. .It Fl r .Em Read . Extract the members of the archive file read from the .Dv standard input , with pathnames matching the specified .Ar patterns . The archive format and blocking is automatically determined on input. When an extracted file is a directory, the entire file hierarchy rooted at that directory is extracted. All extracted files are created relative to the current file hierarchy. The setting of ownership, access and modification times, and file mode of the extracted files are discussed in more detail under the .Fl p option. .It Fl w .Em Write . Write an archive containing the .Ar file operands to .Dv standard output using the specified archive format. When no .Ar file operands are specified, a list of files to copy with one per line is read from .Dv standard input . When a .Ar file operand is also a directory, the entire file hierarchy rooted at that directory will be included. .It Fl r Fl w .Em Copy . Copy the .Ar file operands to the destination .Ar directory . When no .Ar file operands are specified, a list of files to copy with one per line is read from the .Dv standard input . When a .Ar file operand is also a directory the entire file hierarchy rooted at that directory will be included. The effect of the .Em copy is as if the copied files were written to an archive file and then subsequently extracted, except that there may be hard links between the original and the copied files (see the .Fl l option below). .Pp .Em Warning : The destination .Ar directory must not be one of the .Ar file operands or a member of a file hierarchy rooted at one of the .Ar file operands. The result of a .Em copy under these conditions is unpredictable. .El .Pp While processing a damaged archive during a .Em read or .Em list operation, .Nm will attempt to recover from media defects and will search through the archive to locate and process the largest number of archive members possible (see the .Fl E option for more details on error handling). .Sh OPERANDS The .Ar directory operand specifies a destination directory pathname. If the .Ar directory operand does not exist, or it is not writable by the user, or it is not of type directory, .Nm will exit with a non-zero exit status. .Pp The .Ar pattern operand is used to select one or more pathnames of archive members. Archive members are selected using the pattern matching notation described by .Xr fnmatch 3 . When the .Ar pattern operand is not supplied, all members of the archive will be selected. When a .Ar pattern matches a directory, the entire file hierarchy rooted at that directory will be selected. When a .Ar pattern operand does not select at least one archive member, .Nm will write these .Ar pattern operands in a diagnostic message to .Dv standard error and then exit with a non-zero exit status. .Pp The .Ar file operand specifies the pathname of a file to be copied or archived. When a .Ar file operand does not select at least one archive member, .Nm will write these .Ar file operand pathnames in a diagnostic message to .Dv standard error and then exit with a non-zero exit status. .Sh OPTIONS The following options are supported: .Bl -tag -width 4n .It Fl r Read an archive file from .Dv standard input and extract the specified .Ar files . If any intermediate directories are needed in order to extract an archive member, these directories will be created as if .Xr mkdir 2 was called with the bitwise inclusive .Dv OR of .Dv S_IRWXU , S_IRWXG , and .Dv S_IRWXO as the mode argument. When the selected archive format supports the specification of linked files and these files cannot be linked while the archive is being extracted, .Nm will write a diagnostic message to .Dv standard error and exit with a non-zero exit status at the completion of operation. .It Fl w Write files to the .Dv standard output in the specified archive format. When no .Ar file operands are specified, .Dv standard input is read for a list of pathnames with one per line without any leading or trailing .Aq blanks . .It Fl a Append .Ar files to the end of an archive that was previously written. If an archive format is not specified with a .Fl x option, the format currently being used in the archive will be selected. Any attempt to append to an archive in a format different from the format already used in the archive will cause .Nm to exit immediately with a non-zero exit status. The blocking size used in the archive volume where writing starts will continue to be used for the remainder of that archive volume. .Pp .Em Warning : Many storage devices are not able to support the operations necessary to perform an append operation. Any attempt to append to an archive stored on such a device may damage the archive or have other unpredictable results. Tape drives in particular are more likely to not support an append operation. An archive stored in a regular file system file or on a disk device will usually support an append operation. .It Fl b Ar blocksize When .Em writing an archive, block the output at a positive decimal integer number of bytes per write to the archive file. The .Ar blocksize -must be a multiple of 512 bytes with a maximum of 64512 bytes. A +must be a multiple of 512 bytes with a maximum of 64512 bytes. +A .Ar blocksize larger than 32256 bytes violates the .Tn POSIX standard and will not be portable to all systems. A .Ar blocksize can end with .Li k or .Li b to specify multiplication by 1024 (1K) or 512, respectively. A pair of .Ar blocksizes can be separated by .Li x to indicate a product. A specific archive device may impose additional restrictions on the size of blocking it will support. When blocking is not specified, the default .Ar blocksize is dependent on the specific archive format being used (see the .Fl x option). .It Fl c Match all file or archive members .Em except those specified by the .Ar pattern and .Ar file operands. .It Fl d Cause files of type directory being copied or archived, or archive members of type directory being extracted, to match only the directory file or archive member and not the file hierarchy rooted at the directory. .It Fl f Ar archive Specify .Ar archive as the pathname of the input or output archive, overriding the default .Dv standard input (for .Em list and .Em read ) or .Dv standard output (for .Em write ) . A single archive may span multiple files and different archive devices. When required, .Nm will prompt for the pathname of the file or device of the next volume in the archive. .It Fl i Interactively rename files or archive members. For each archive member matching a .Ar pattern operand or each file matching a .Ar file operand, .Nm will prompt to .Pa /dev/tty giving the name of the file, its file mode and its modification time. The .Nm utility will then read a line from .Pa /dev/tty . If this line is blank, the file or archive member is skipped. If this line consists of a single period, the file or archive member is processed with no modification to its name. Otherwise, its name is replaced with the contents of the line. The .Nm utility will immediately exit with a non-zero exit status if .Dv is encountered when reading a response or if .Pa /dev/tty cannot be opened for reading and writing. .It Fl k Do not overwrite existing files. .It Fl l Link files. (The letter ell). In the .Em copy mode .Pq Fl r w , hard links are made between the source and destination file hierarchies whenever possible. .It Fl n Select the first archive member that matches each .Ar pattern operand. No more than one archive member is matched for each .Ar pattern . When members of type directory are matched, the file hierarchy rooted at that directory is also matched (unless .Fl d is also specified). .It Fl o Ar options Information to modify the algorithm for extracting or writing archive files which is specific to the archive format specified by .Fl x . In general, .Ar options take the form: .Cm name=value .It Fl p Ar string Specify one or more file characteristic options (privileges). The .Ar string option-argument is a string specifying file characteristics to be retained or discarded on extraction. The string consists of the specification characters .Cm a , e , m , o , and .Cm p . Multiple characteristics can be concatenated within the same string and multiple .Fl p options can be specified. The meaning of the specification characters are as follows: .Bl -tag -width 2n .It Cm a Do not preserve file access times. By default, file access times are preserved whenever possible. .It Cm e .Sq Preserve everything , the user ID, group ID, file mode bits, file access time, and file modification time. This is intended to be used by .Em root , someone with all the appropriate privileges, in order to preserve all aspects of the files as they are recorded in the archive. The .Cm e flag is the sum of the .Cm o and .Cm p flags. .It Cm m Do not preserve file modification times. By default, file modification times are preserved whenever possible. .It Cm o Preserve the user ID and group ID. .It Cm p .Sq Preserve the file mode bits. This intended to be used by a .Em user with regular privileges who wants to preserve all aspects of the file other than the ownership. The file times are preserved by default, but two other flags are offered to disable this and use the time of extraction instead. .El .Pp In the preceding list, .Sq preserve indicates that an attribute stored in the archive is given to the extracted file, subject to the permissions of the invoking process. Otherwise the attribute of the extracted file is determined as part of the normal file creation action. If neither the .Cm e nor the .Cm o specification character is specified, or the user ID and group ID are not preserved for any reason, .Nm will not set the .Dv S_ISUID .Em ( setuid ) and .Dv S_ISGID .Em ( setgid ) bits of the file mode. If the preservation of any of these items fails for any reason, .Nm will write a diagnostic message to .Dv standard error . Failure to preserve these items will affect the final exit status, but will not cause the extracted file to be deleted. If the file characteristic letters in any of the string option-arguments are duplicated or conflict with each other, the one(s) given last will take precedence. For example, if .Dl Fl p Ar eme is specified, file modification times are still preserved. .It Fl s Ar replstr Modify the file or archive member names specified by the .Ar pattern or .Ar file operands according to the substitution expression .Ar replstr , using the syntax of the .Xr ed 1 utility regular expressions. The format of these regular expressions are: .Dl /old/new/[gp] As in .Xr ed 1 , .Cm old is a basic regular expression and .Cm new can contain an ampersand (&), \\n (where n is a digit) back-references, or subexpression matching. The .Cm old string may also contain .Dv characters. Any non-null character can be used as a delimiter (/ is shown here). Multiple .Fl s expressions can be specified. The expressions are applied in the order they are specified on the command line, terminating with the first successful substitution. The optional trailing .Cm g continues to apply the substitution expression to the pathname substring which starts with the first character following the end of the last successful substitution. The first unsuccessful substitution stops the operation of the .Cm g option. The optional trailing .Cm p will cause the final result of a successful substitution to be written to .Dv standard error in the following format: .Dl >> File or archive member names that substitute to the empty string are not selected and will be skipped. .It Fl t Reset the access times of any file or directory read or accessed by .Nm to be the same as they were before being read or accessed by .Nm . .It Fl u Ignore files that are older (having a less recent file modification time) than a pre-existing file or archive member with the same name. During .Em read , an archive member with the same name as a file in the file system will be extracted if the archive member is newer than the file. During .Em write , a file system member with the same name as an archive member will be written to the archive if it is newer than the archive member. During .Em copy , the file in the destination hierarchy is replaced by the file in the source hierarchy or by a link to the file in the source hierarchy if the file in the source hierarchy is newer. .It Fl v During a .Em list operation, produce a verbose table of contents using the format of the .Xr ls 1 utility with the .Fl l option. For pathnames representing a hard link to a previous member of the archive, the output has the format: .Dl == For pathnames representing a symbolic link, the output has the format: .Dl => Where is the output format specified by the .Xr ls 1 utility when used with the .Fl l option. Otherwise for all the other operational modes .Em ( read , write , and .Em copy ) , pathnames are written and flushed to .Dv standard error without a trailing .Dv as soon as processing begins on that file or archive member. The trailing .Dv , is not buffered, and is written only after the file has been read or written. .It Fl x Ar format Specify the output archive format, with the default format being .Ar ustar . The .Nm utility currently supports the following formats: .Bl -tag -width "sv4cpio" .It Ar cpio The extended cpio interchange format specified in the .St -p1003.2 standard. The default blocksize for this format is 5120 bytes. Inode and device information about a file (used for detecting file hard links by this format) which may be truncated by this format is detected by .Nm and is repaired. .It Ar bcpio The old binary cpio format. The default blocksize for this format is 5120 bytes. This format is not very portable and should not be used when other formats are available. Inode and device information about a file (used for detecting file hard links by this format) which may be truncated by this format is detected by .Nm and is repaired. .It Ar sv4cpio The System V release 4 cpio. The default blocksize for this format is 5120 bytes. Inode and device information about a file (used for detecting file hard links by this format) which may be truncated by this format is detected by .Nm and is repaired. .It Ar sv4crc The System V release 4 cpio with file crc checksums. The default blocksize for this format is 5120 bytes. Inode and device information about a file (used for detecting file hard links by this format) which may be truncated by this format is detected by .Nm and is repaired. .It Ar tar The old .Bx tar format as found in .Bx 4.3 . The default blocksize for this format is 10240 bytes. Pathnames stored by this format must be 100 characters or less in length. Only .Em regular files, .Em hard links , soft links , and .Em directories will be archived (other file system types are not supported). For backwards compatibility with even older tar formats, a .Fl o option can be used when writing an archive to omit the storage of directories. This option takes the form: .Dl Fl o Cm write_opt=nodir .It Ar ustar The extended tar interchange format specified in the .St -p1003.2 standard. The default blocksize for this format is 10240 bytes. Pathnames stored by this format must be 250 characters or less in length. .El .Pp The .Nm utility will detect and report any file that it is unable to store or extract as the result of any specific archive format restrictions. The individual archive formats may impose additional restrictions on use. Typical archive format restrictions include (but are not limited to): file pathname length, file size, link pathname length and the type of the file. .It Fl z Use .Xr gzip 1 to compress (decompress) the archive while writing (reading). Incompatible with .Fl a . .It Fl B Ar bytes Limit the number of bytes written to a single archive volume to .Ar bytes . The .Ar bytes limit can end with .Li m , .Li k , or .Li b to specify multiplication by 1048576 (1M), 1024 (1K) or 512, respectively. A pair of .Ar bytes limits can be separated by .Li x to indicate a product. .Pp .Em Warning : Only use this option when writing an archive to a device which supports an end of file read condition based on last (or largest) write offset (such as a regular file or a tape drive). The use of this option with a floppy or hard disk is not recommended. .It Fl D This option is the same as the .Fl u option, except that the file inode change time is checked instead of the file modification time. The file inode change time can be used to select files whose inode information (e.g.\& uid, gid, etc.) is newer than a copy of the file in the destination .Ar directory . .It Fl E Ar limit Limit the number of consecutive read faults while trying to read a flawed archives to .Ar limit . With a positive .Ar limit , .Nm will attempt to recover from an archive read error and will continue processing starting with the next file stored in the archive. A .Ar limit of 0 will cause .Nm to stop operation after the first read error is detected on an archive volume. A .Ar limit of .Li NONE will cause .Nm to attempt to recover from read errors forever. The default .Ar limit is a small positive number of retries. .Pp .Em Warning : Using this option with .Li NONE should be used with extreme caution as .Nm may get stuck in an infinite loop on a very badly flawed archive. .It Fl G Ar group Select a file based on its .Ar group name, or when starting with a .Cm # , a numeric gid. A '\\' can be used to escape the .Cm # . Multiple .Fl G options may be supplied and checking stops with the first match. .It Fl H Follow only command line symbolic links while performing a physical file system traversal. .It Fl L Follow all symbolic links to perform a logical file system traversal. .It Fl P Do not follow symbolic links, perform a physical file system traversal. This is the default mode. .It Fl T Ar [from_date][,to_date][/[c][m]] Allow files to be selected based on a file modification or inode change time falling within a specified time range of .Ar from_date to .Ar to_date (the dates are inclusive). If only a .Ar from_date is supplied, all files with a modification or inode change time equal to or younger are selected. If only a .Ar to_date is supplied, all files with a modification or inode change time equal to or older will be selected. When the .Ar from_date is equal to the .Ar to_date , only files with a modification or inode change time of exactly that time will be selected. .Pp When .Nm is in the .Em write or .Em copy mode, the optional trailing field .Ar [c][m] can be used to determine which file time (inode change, file modification or both) are used in the comparison. If neither is specified, the default is to use file modification time only. The .Ar m specifies the comparison of file modification time (the time when the file was last written). The .Ar c specifies the comparison of inode change time (the time when the file inode was last changed; e.g.\& a change of owner, group, mode, etc). When .Ar c and .Ar m are both specified, then the modification and inode change times are both compared. The inode change time comparison is useful in selecting files whose attributes were recently changed or selecting files which were recently created and had their modification time reset to an older time (as what happens when a file is extracted from an archive and the modification time is preserved). Time comparisons using both file times is useful when .Nm is used to create a time based incremental archive (only files that were changed during a specified time range will be archived). .Pp A time range is made up of six different fields and each field must contain two digits. The format is: .Dl [yy[mm[dd[hh]]]]mm[.ss] Where .Cm yy is the last two digits of the year, the first .Cm mm is the month (from 01 to 12), .Cm dd is the day of the month (from 01 to 31), .Cm hh is the hour of the day (from 00 to 23), the second .Cm mm is the minute (from 00 to 59), and .Cm ss is the seconds (from 00 to 59). The minute field .Cm mm is required, while the other fields are optional and must be added in the following order: .Dl Cm hh , dd , mm , yy . The .Cm ss field may be added independently of the other fields. Time ranges are relative to the current time, so .Dl Fl T Ar 1234/cm would select all files with a modification or inode change time of 12:34 PM today or later. Multiple .Fl T time range can be supplied and checking stops with the first match. .It Fl U Ar user Select a file based on its .Ar user name, or when starting with a .Cm # , a numeric uid. A '\\' can be used to escape the .Cm # . Multiple .Fl U options may be supplied and checking stops with the first match. .It Fl X When traversing the file hierarchy specified by a pathname, do not descend into directories that have a different device ID. See the .Li st_dev field as described in .Xr stat 2 for more information about device ID's. .It Fl Y This option is the same as the .Fl D option, except that the inode change time is checked using the pathname created after all the file name modifications have completed. .It Fl Z This option is the same as the .Fl u option, except that the modification time is checked using the pathname created after all the file name modifications have completed. .El .Pp The options that operate on the names of files or archive members .Fl ( c , .Fl i , .Fl n , .Fl s , .Fl u , .Fl v , .Fl D , .Fl G , .Fl T , .Fl U , .Fl Y , and .Fl Z ) interact as follows. .Pp When extracting files during a .Em read operation, archive members are .Sq selected , based only on the user specified pattern operands as modified by the .Fl c , .Fl n , .Fl u , .Fl D , .Fl G , .Fl T , .Fl U options. Then any .Fl s and .Fl i options will modify in that order, the names of these selected files. Then the .Fl Y and .Fl Z options will be applied based on the final pathname. Finally the .Fl v option will write the names resulting from these modifications. .Pp When archiving files during a .Em write operation, or copying files during a .Em copy operation, archive members are .Sq selected , based only on the user specified pathnames as modified by the .Fl n , .Fl u , .Fl D , .Fl G , .Fl T , and .Fl U options (the .Fl D option only applies during a copy operation). Then any .Fl s and .Fl i options will modify in that order, the names of these selected files. Then during a .Em copy operation the .Fl Y and the .Fl Z options will be applied based on the final pathname. Finally the .Fl v option will write the names resulting from these modifications. .Pp When one or both of the .Fl u or .Fl D options are specified along with the .Fl n option, a file is not considered selected unless it is newer than the file to which it is compared. .Sh EXIT STATUS The .Nm utility will exit with one of the following values: .Bl -tag -width 2n .It 0 All files were processed successfully. .It 1 An error occurred. .El .Sh EXAMPLES The command: .Dl "pax -w -f /dev/sa0 ." copies the contents of the current directory to the device .Pa /dev/sa0 . .Pp The command: .Dl pax -v -f filename gives the verbose table of contents for an archive stored in .Pa filename . .Pp The following commands: .Dl mkdir /tmp/to .Dl cd /tmp/from .Dl pax -rw .\ /tmp/to will copy the entire .Pa /tmp/from directory hierarchy to .Pa /tmp/to . .Pp The command: .Dl pax -r -s ',^//*usr//*,,' -f a.pax reads the archive .Pa a.pax , with all files rooted in ``/usr'' into the archive extracted relative to the current directory. .Pp The command: .Dl pax -rw -i .\ dest_dir can be used to interactively select the files to copy from the current directory to .Pa dest_dir . .Pp The command: .Dl pax -r -pe -U root -G bin -f a.pax will extract all files from the archive .Pa a.pax which are owned by .Em root with group .Em bin and will preserve all file permissions. .Pp The command: .Dl pax -r -w -v -Y -Z home /backup will update (and list) only those files in the destination directory .Pa /backup which are older (less recent inode change or file modification times) than files with the same name found in the source file tree .Pa home . .Sh DIAGNOSTICS Whenever .Nm cannot create a file or a link when reading an archive or cannot find a file when writing an archive, or cannot preserve the user ID, group ID, or file mode when the .Fl p option is specified, a diagnostic message is written to .Dv standard error and a non-zero exit status will be returned, but processing will continue. In the case where pax cannot create a link to a file, .Nm will not create a second copy of the file. .Pp If the extraction of a file from an archive is prematurely terminated by a signal or error, .Nm may have only partially extracted a file the user wanted. Additionally, the file modes of extracted files and directories may have incorrect file bits, and the modification and access times may be wrong. .Pp If the creation of an archive is prematurely terminated by a signal or error, .Nm may have only partially created the archive which may violate the specific archive format specification. .Pp If while doing a .Em copy , .Nm detects a file is about to overwrite itself, the file is not copied, a diagnostic message is written to .Dv standard error and when .Nm completes it will exit with a non-zero exit status. .Sh SEE ALSO .Xr cpio 1 , .Xr tar 1 .Sh STANDARDS The .Nm utility is a superset of the .St -p1003.2 standard. The options .Fl z , .Fl B , .Fl D , .Fl E , .Fl G , .Fl H , .Fl L , .Fl P , .Fl T , .Fl U , .Fl Y , .Fl Z , the archive formats .Ar bcpio , .Ar sv4cpio , .Ar sv4crc , .Ar tar , and the flawed archive handling during .Ar list and .Ar read operations are extensions to the .Tn POSIX standard. .Sh HISTORY The .Nm utility appeared in .Bx 4.4 . .Sh AUTHORS .An Keith Muller at the University of California, San Diego .Sh BUGS The .Nm utility does not recognize multibyte characters. Index: head/bin/ps/ps.1 =================================================================== --- head/bin/ps/ps.1 (revision 162378) +++ head/bin/ps/ps.1 (revision 162379) @@ -1,664 +1,664 @@ .\"- .\" Copyright (c) 1980, 1990, 1991, 1993, 1994 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" .Dd August 21, 2006 .Dt PS 1 .Os .Sh NAME .Nm ps .Nd process status .Sh SYNOPSIS .Nm .Op Fl aCcefHhjlmrSTuvwXxZ .Op Fl O Ar fmt | Fl o Ar fmt .Op Fl G Ar gid Ns Op , Ns Ar gid Ns Ar ... .Op Fl M Ar core .Op Fl N Ar system .Op Fl p Ar pid Ns Op , Ns Ar pid Ns Ar ... .Op Fl t Ar tty Ns Op , Ns Ar tty Ns Ar ... .Op Fl U Ar user Ns Op , Ns Ar user Ns Ar ... .Nm .Op Fl L .Sh DESCRIPTION The .Nm utility displays a header line, followed by lines containing information about all of your processes that have controlling terminals. .Pp A different set of processes can be selected for display by using any combination of the .Fl a , G , p , T , t , and .Fl U options. If more than one of these options are given, then .Nm will select all processes which are matched by at least one of the given options. .Pp For the processes which have been selected for display, .Nm will usually display one line per process. The .Fl H option may result in multiple output lines (one line per thread) for some processes. By default all of these output lines are sorted first by controlling terminal, then by process ID. The .Fl m , r , u , and .Fl v options will change the sort order. If more than one sorting option was given, then the selected processes will be sorted by the last sorting option which was specified. .Pp For the processes which have been selected for display, the information to display is selected based on a set of keywords (see the .Fl L , O , and .Fl o options). The default output format includes, for each process, the process' ID, controlling terminal, CPU time (including both user and system time), state, and associated command. .Pp The process file system (see .Xr procfs 5 ) should be mounted when .Nm is executed, otherwise not all information will be available. .Pp The options are as follows: .Bl -tag -width indent .It Fl a Display information about other users' processes as well as your own. This will skip any processes which do not have a controlling terminal, unless the .Fl x option is also specified. This can be disabled by setting the .Va security.bsd.see_other_uids sysctl to zero. .It Fl c Change the .Dq command column output to just contain the executable name, rather than the full command line. .It Fl C Change the way the CPU percentage is calculated by using a .Dq raw CPU calculation that ignores .Dq resident time (this normally has no effect). .It Fl e Display the environment as well. .It Fl f Show commandline and environment information about swapped out processes. This option is honored only if the UID of the user is 0. .It Fl G Display information about processes which are running with the specified real group IDs. .It Fl H Show all of the .Em kernel visible threads associated with each process. Depending on the threading package that is in use, this may show only the process, only the kernel scheduled entities, or all of the process threads. .It Fl h Repeat the information header as often as necessary to guarantee one header per page of information. .It Fl j Print information associated with the following keywords: .Cm user , pid , ppid , pgid , sid , jobc , state , tt , time , and .Cm command . .It Fl L List the set of keywords available for the .Fl O and .Fl o options. .It Fl l Display information associated with the following keywords: .Cm uid , pid , ppid , cpu , pri , nice , vsz , rss , mwchan , state , .Cm tt , time , and .Cm command . .It Fl M Extract values associated with the name list from the specified core instead of the currently running system. .It Fl m Sort by memory usage, instead of the combination of controlling terminal and process ID. .It Fl N Extract the name list from the specified system instead of the default, which is the kernel image the system has booted from. .It Fl O Add the information associated with the space or comma separated list of keywords specified, after the process ID, in the default information display. Keywords may be appended with an equals .Pq Ql = sign and a string. This causes the printed header to use the specified string instead of the standard header. .It Fl o Display information associated with the space or comma separated list of keywords specified. The last keyword in the list may be appended with an equals .Pq Ql = -sign and a string that spans the rest of the argument and can contain +sign and a string that spans the rest of the argument, and can contain space and comma characters. This causes the printed header to use the specified string instead of the standard header. Multiple keywords may also be given in the form of more than one .Fl o option. So the header texts for multiple keywords can be changed. If all keywords have empty header texts, no header line is written. .It Fl p Display information about processes which match the specified process IDs. .It Fl r Sort by current CPU usage, instead of the combination of controlling terminal and process ID. .It Fl S Change the way the process time is calculated by summing all exited children to their parent process. .It Fl T Display information about processes attached to the device associated with the standard input. .It Fl t Display information about processes attached to the specified terminal devices. .It Fl U Display the processes belonging to the specified usernames. .It Fl u Display information associated with the following keywords: .Cm user , pid , %cpu , %mem , vsz , rss , tt , state , start , time , and .Cm command . The .Fl u option implies the .Fl r option. .It Fl v Display information associated with the following keywords: .Cm pid , state , time , sl , re , pagein , vsz , rss , lim , tsiz , .Cm %cpu , %mem , and .Cm command . The .Fl v option implies the .Fl m option. .It Fl w Use 132 columns to display information, instead of the default which is your window size. If the .Fl w option is specified more than once, .Nm will use as many columns as necessary without regard for your window size. .It Fl X When displaying processes matched by other options, skip any processes which do not have a controlling terminal. .It Fl x When displaying processes matched by other options, include processes which do not have a controlling terminal. This is the opposite of the .Fl X option. If both .Fl X and .Fl x are specified in the same command, then .Nm will use the one which was specified last. .It Fl Z Add .Xr mac 4 label to the list of keywords for which .Nm will display information. .El .Pp A complete list of the available keywords are listed below. Some of these keywords are further specified as follows: .Bl -tag -width lockname .It Cm %cpu The CPU utilization of the process; this is a decaying average over up to a minute of previous (real) time. Since the time base over which this is computed varies (since processes may be very young) it is possible for the sum of all .Cm %cpu fields to exceed 100%. .It Cm %mem The percentage of real memory used by this process. .It Cm flags The flags associated with the process as in the include file .In sys/proc.h : .Bl -column P_STOPPED_SINGLE 0x4000000 .It Dv "P_ADVLOCK" Ta No "0x00001 Process may hold a POSIX advisory lock" .It Dv "P_CONTROLT" Ta No "0x00002 Has a controlling terminal" .It Dv "P_KTHREAD" Ta No "0x00004 Kernel thread" .It Dv "P_NOLOAD" Ta No "0x00008 Ignore during load avg calculations" .It Dv "P_PPWAIT" Ta No "0x00010 Parent is waiting for child to exec/exit" .It Dv "P_PROFIL" Ta No "0x00020 Has started profiling" .It Dv "P_STOPPROF" Ta No "0x00040 Has thread in requesting to stop prof" .It Dv "P_SUGID" Ta No "0x00100 Had set id privileges since last exec" .It Dv "P_SYSTEM" Ta No "0x00200 System proc: no sigs, stats or swapping" .It Dv "P_SINGLE_EXIT" Ta No "0x00400 Threads suspending should exit, not wait" .It Dv "P_TRACED" Ta No "0x00800 Debugged process being traced" .It Dv "P_WAITED" Ta No "0x01000 Someone is waiting for us" .It Dv "P_WEXIT" Ta No "0x02000 Working on exiting" .It Dv "P_EXEC" Ta No "0x04000 Process called exec" .It Dv "P_SA" Ta No "0x08000 Using scheduler activations" .It Dv "P_CONTINUED" Ta No "0x10000 Proc has continued from a stopped state" .It Dv "P_STOPPED_SIG" Ta No "0x20000 Stopped due to SIGSTOP/SIGTSTP" .It Dv "P_STOPPED_TRACE" Ta No "0x40000 Stopped because of tracing" .It Dv "P_STOPPED_SINGLE" Ta No "0x80000 Only one thread can continue" .It Dv "P_PROTECTED" Ta No "0x100000 Do not kill on memory overcommit" .It Dv "P_SIGEVENT" Ta No "0x200000 Process pending signals changed" .It Dv "P_JAILED" Ta No "0x1000000 Process is in jail" .It Dv "P_INEXEC" Ta No "0x4000000 Process is in execve()" .El .It Cm label The MAC label of the process. .It Cm lim The soft limit on memory used, specified via a call to .Xr setrlimit 2 . .It Cm lstart The exact time the command started, using the .Ql %c format described in .Xr strftime 3 . .It Cm lockname The name of the lock that the process is currently blocked on. If the name is invalid or unknown, then .Dq ???\& is displayed. .It Cm logname The login name associated with the session the process is in (see .Xr getlogin 2 ) . .It Cm mwchan The event name if the process is blocked normally, or the lock name if the process is blocked on a lock. See the wchan and lockname keywords for details. .It Cm nice The process scheduling increment (see .Xr setpriority 2 ) . .It Cm rss the real memory (resident set) size of the process (in 1024 byte units). .It Cm start The time the command started. If the command started less than 24 hours ago, the start time is displayed using the .Dq Li %l:ps.1p format described in .Xr strftime 3 . If the command started less than 7 days ago, the start time is displayed using the .Dq Li %a6.15p format. Otherwise, the start time is displayed using the .Dq Li %e%b%y format. .It Cm state The state is given by a sequence of characters, for example, .Dq Li RWNA . The first character indicates the run state of the process: .Pp .Bl -tag -width indent -compact .It Li D Marks a process in disk (or other short term, uninterruptible) wait. .It Li I Marks a process that is idle (sleeping for longer than about 20 seconds). .It Li L Marks a process that is waiting to acquire a lock. .It Li R Marks a runnable process. .It Li S Marks a process that is sleeping for less than about 20 seconds. .It Li T Marks a stopped process. .It Li W Marks an idle interrupt thread. .It Li Z Marks a dead process (a .Dq zombie ) . .El .Pp Additional characters after these, if any, indicate additional state information: .Pp .Bl -tag -width indent -compact .It Li + The process is in the foreground process group of its control terminal. .It Li < The process has raised CPU scheduling priority. .It Li E The process is trying to exit. .It Li J Marks a process which is in .Xr jail 2 . The hostname of the prison can be found in .Pa /proc/ Ns Ao Ar pid Ac Ns Pa /status . .It Li L The process has pages locked in core (for example, for raw .Tn I/O ) . .It Li N The process has reduced CPU scheduling priority (see .Xr setpriority 2 ) . .It Li s The process is a session leader. .It Li V The process is suspended during a .Xr vfork 2 . .It Li W The process is swapped out. .It Li X The process is being traced or debugged. .El .It Cm tt An abbreviation for the pathname of the controlling terminal, if any. The abbreviation consists of the three letters following .Pa /dev/tty , or, for the console, .Dq Li con . This is followed by a .Ql - if the process can no longer reach that controlling terminal (i.e., it has been revoked). .It Cm wchan The event (an address in the system) on which a process waits. When printed numerically, the initial part of the address is trimmed off and the result is printed in hex, for example, 0x80324000 prints as 324000. .El .Pp When printing using the command keyword, a process that has exited and has a parent that has not yet waited for the process (in other words, a zombie) is listed as .Dq Li , and a process which is blocked while trying to exit is listed as .Dq Li . If the arguments cannot be located (usually because it has not been set, as is the case of system processes and/or kernel threads) the command name is printed within square brackets. The .Nm utility first tries to obtain the arguments cached by the kernel (if they were shorter than the value of the .Va kern.ps_arg_cache_limit sysctl). The process can change the arguments shown with .Xr setproctitle 3 . Otherwise, .Nm makes an educated guess as to the file name and arguments given when the process was created by examining memory or the swap area. The method is inherently somewhat unreliable and in any event a process is entitled to destroy this information. The ucomm (accounting) keyword can, however, be depended on. If the arguments are unavailable or do not agree with the ucomm keyword, the value for the ucomm keyword is appended to the arguments in parentheses. .Sh KEYWORDS The following is a complete list of the available keywords and their meanings. Several of them have aliases (keywords which are synonyms). .Pp .Bl -tag -width ".Cm sigignore" -compact .It Cm %cpu percentage CPU usage (alias .Cm pcpu ) .It Cm %mem percentage memory usage (alias .Cm pmem ) .It Cm acflag accounting flag (alias .Cm acflg ) .It Cm args command and arguments .It Cm comm command .It Cm command command and arguments .It Cm cpu short-term CPU usage factor (for scheduling) .It Cm etime elapsed running time .It Cm flags the process flags, in hexadecimal (alias .Cm f ) .It Cm inblk total blocks read (alias .Cm inblock ) .It Cm jid jail ID .It Cm jobc job control count .It Cm ktrace tracing flags .It Cm label MAC label .It Cm lim memoryuse limit .It Cm lockname lock currently blocked on (as a symbolic name) .It Cm logname login name of user who started the session .It Cm lstart time started .It Cm majflt total page faults .It Cm minflt total page reclaims .It Cm msgrcv total messages received (reads from pipes/sockets) .It Cm msgsnd total messages sent (writes on pipes/sockets) .It Cm mwchan wait channel or lock currently blocked on .It Cm nice nice value (alias .Cm ni ) .It Cm nivcsw total involuntary context switches .It Cm nsigs total signals taken (alias .Cm nsignals ) .It Cm nswap total swaps in/out .It Cm nvcsw total voluntary context switches .It Cm nwchan wait channel (as an address) .It Cm oublk total blocks written (alias .Cm oublock ) .It Cm paddr swap address .It Cm pagein pageins (same as majflt) .It Cm pgid process group number .It Cm pid process ID .It Cm poip pageouts in progress .It Cm ppid parent process ID .It Cm pri scheduling priority .It Cm re core residency time (in seconds; 127 = infinity) .It Cm rgid real group ID .It Cm rgroup group name (from rgid) .It Cm rlink reverse link on run queue, or 0 .It Cm rss resident set size .It Cm rtprio realtime priority (101 = not a realtime process) .It Cm ruid real user ID .It Cm ruser user name (from ruid) .It Cm sid session ID .It Cm sig pending signals (alias .Cm pending ) .It Cm sigcatch caught signals (alias .Cm caught ) .It Cm sigignore ignored signals (alias .Cm ignored ) .It Cm sigmask blocked signals (alias .Cm blocked ) .It Cm sl sleep time (in seconds; 127 = infinity) .It Cm start time started .It Cm state symbolic process state (alias .Cm stat ) .It Cm svgid saved gid from a setgid executable .It Cm svuid saved UID from a setuid executable .It Cm tdev control terminal device number .It Cm time accumulated CPU time, user + system (alias .Cm cputime ) .It Cm tpgid control terminal process group ID .\".It Cm trss .\"text resident set size (in Kbytes) .It Cm tsid control terminal session ID .It Cm tsiz text size (in Kbytes) .It Cm tt control terminal name (two letter abbreviation) .It Cm tty full name of control terminal .It Cm uprocp process pointer .It Cm ucomm name to be used for accounting .It Cm uid effective user ID .It Cm upr scheduling priority on return from system call (alias .Cm usrpri ) .It Cm user user name (from UID) .It Cm vsz virtual size in Kbytes (alias .Cm vsize ) .It Cm wchan wait channel (as a symbolic name) .It Cm xstat exit or stop status (valid only for stopped or zombie process) .El .Sh ENVIRONMENT The following environment variables affect the execution of .Nm : .Bl -tag -width ".Ev COLUMNS" .It Ev COLUMNS If set, specifies the user's preferred output width in column positions. By default, .Nm attempts to automatically determine the terminal width. .El .Sh FILES .Bl -tag -width ".Pa /boot/kernel/kernel" -compact .It Pa /boot/kernel/kernel default system namelist .It Pa /proc the mount point of .Xr procfs 5 .El .Sh SEE ALSO .Xr kill 1 , .Xr pgrep 1 , .Xr pkill 1 , .Xr w 1 , .Xr kvm 3 , .Xr strftime 3 , .Xr mac 4 , .Xr procfs 5 , .Xr pstat 8 , .Xr sysctl 8 , .Xr mutex 9 .Sh STANDARDS For historical reasons, the .Nm utility under .Fx supports a different set of options from what is described by .St -p1003.2 , and what is supported on .No non- Ns Bx operating systems. .Sh HISTORY The .Nm command appeared in .At v4 . .Sh BUGS Since .Nm cannot run faster than the system and is run as any other scheduled process, the information it displays can never be exact. .Pp The .Nm utility does not correctly display argument lists containing multibyte characters. Index: head/bin/setfacl/setfacl.1 =================================================================== --- head/bin/setfacl/setfacl.1 (revision 162378) +++ head/bin/setfacl/setfacl.1 (revision 162379) @@ -1,295 +1,296 @@ .\"- .\" Copyright (c) 2001 Chris D. Faulhaber .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd January 7, 2001 .Dt SETFACL 1 .Os .Sh NAME .Nm setfacl .Nd set ACL information .Sh SYNOPSIS .Nm .Op Fl bdhkn .Op Fl m Ar entries .Op Fl M Ar file .Op Fl x Ar entries .Op Fl X Ar file .Op Ar .Sh DESCRIPTION The .Nm utility sets discretionary access control information on the specified file(s). -If no files are specified, or the list consists of the -only "-", the file names are taken from the standard input. +If no files are specified, or the list consists of the only +.Sq Fl , +the file names are taken from the standard input. .Pp The following options are available: .Bl -tag -width indent .It Fl b Remove all ACL entries except for the three required entries. If the ACL contains a .Dq Li mask entry, the permissions of the .Dq Li group entry in the resulting ACL will be set to the permission associated with both the .Dq Li group and .Dq Li mask entries of the current ACL. .It Fl d The operations apply to the default ACL entries instead of access ACL entries. Currently only directories may have default ACL's. .It Fl h If the target of the operation is a symbolic link, perform the operation on the symbolic link itself, rather than following the link. .It Fl k Delete any default ACL entries on the specified files. It is not considered an error if the specified files do not have any default ACL entries. An error will be reported if any of the specified files cannot have a default entry (i.e.\& non-directories). .It Fl m Ar entries Modify the ACL entries on the specified files by adding new entries and modifying existing ACL entries with the ACL entries specified in .Ar entries . .It Fl M Ar file Modify the ACL entries on the specified files by adding new ACL entries and modifying existing ACL entries with the ACL entries specified in the file .Ar file . If .Ar file is .Fl , the input is taken from stdin. .It Fl n Do not recalculate the permissions associated with the ACL mask entry. .It Fl x Ar entries Remove the ACL entries specified in .Ar entries from the access or default ACL of the specified files. .It Fl X Ar file Remove the ACL entries specified in the file .Ar file from the access or default ACL of the specified files. .El .Pp The above options are evaluated in the order specified on the command-line. .Sh ACL ENTRIES An ACL entry contains three colon-separated fields: an ACL tag, an ACL qualifier, and discretionary access permissions: .Bl -tag -width indent .It Ar "ACL tag" The ACL tag specifies the ACL entry type and consists of one of the following: .Dq Li user or .Ql u specifying the access granted to the owner of the file or a specified user; .Dq Li group or .Ql g specifying the access granted to the file owning group or a specified group; .Dq Li other or .Ql o specifying the access granted to any process that does not match any user or group ACL entry; .Dq Li mask or .Ql m specifying the maximum access granted to any ACL entry except the .Dq Li user ACL entry for the file owner and the .Dq Li other ACL entry. .It Ar "ACL qualifier" The ACL qualifier field describes the user or group associated with the ACL entry. It may consist of one of the following: uid or user name, gid or group name, or empty. For .Dq Li user ACL entries, an empty field specifies access granted to the file owner. For .Dq Li group ACL entries, an empty field specifies access granted to the file owning group. .Dq Li mask and .Dq Li other ACL entries do not use this field. .It Ar "access permissions" The access permissions field contains up to one of each of the following: .Ql r , .Ql w , and .Ql x to set read, write, and execute permissions, respectively. Each of these may be excluded or replaced with a .Ql - character to indicate no access. .El .Pp A .Dq Li mask ACL entry is required on a file with any ACL entries other than the default .Dq Li user , .Dq Li group , and .Dq Li other ACL entries. If the .Fl n option is not specified and no .Dq Li mask ACL entry was specified, the .Nm utility will apply a .Dq Li mask ACL entry consisting of the union of the permissions associated with all .Dq Li group ACL entries in the resulting ACL. .Pp Traditional POSIX interfaces acting on file system object modes have modified semantics in the presence of POSIX.1e extended ACLs. When a mask entry is present on the access ACL of an object, the mask entry is substituted for the group bits; this occurs in programs such as .Xr stat 1 or .Xr ls 1 . When the mode is modified on an object that has a mask entry, the changes applied to the group bits will actually be applied to the mask entry. These semantics provide for greater application compatibility: applications modifying the mode instead of the ACL will see conservative behavior, limiting the effective rights granted by all of the additional user and group entries; this occurs in programs such as .Xr chmod 1 . .Pp ACL entries applied from a file using the .Fl M or .Fl X options shall be of the following form: one ACL entry per line, as previously specified; whitespace is ignored; any text after a .Ql # is ignored (comments). .Pp When ACL entries are evaluated, the access check algorithm checks the ACL entries in the following order: file owner, .Dq Li user ACL entries, file owning group, .Dq Li group ACL entries, and .Dq Li other ACL entry. .Pp Multiple ACL entries specified on the command line are separated by commas. .Sh EXIT STATUS .Ex -std .Sh EXAMPLES .Dl setfacl -m u::rwx,g:mail:rw file .Pp Sets read, write, and execute permissions for the .Pa file owner's ACL entry and read and write permissions for group mail on .Pa file . .Pp .Dl setfacl -M file1 file2 .Pp Sets/updates the ACL entries contained in .Pa file1 on .Pa file2 . .Pp .Dl setfacl -x g:mail:rw file .Pp Remove the group mail ACL entry containing read/write permissions from .Pa file . .Pp .Dl setfacl -bn file .Pp Remove all .Dq Li access ACL entries except for the three required from .Pa file . .Pp .Dl getfacl file1 | setfacl -b -n -M - file2 .Pp Copy ACL entries from .Pa file1 to .Pa file2 . .Sh SEE ALSO .Xr getfacl 1 , .Xr acl 3 , .Xr getextattr 8 , .Xr setextattr 8 , .Xr acl 9 , .Xr extattr 9 .Sh STANDARDS The .Nm utility is expected to be .Tn IEEE Std 1003.2c compliant. .Sh HISTORY Extended Attribute and Access Control List support was developed as part of the .Tn TrustedBSD Project and introduced in .Fx 5.0 . .Sh AUTHORS The .Nm utility was written by .An Chris D. Faulhaber Aq jedgar@fxp.org . Index: head/bin/sh/sh.1 =================================================================== --- head/bin/sh/sh.1 (revision 162378) +++ head/bin/sh/sh.1 (revision 162379) @@ -1,2267 +1,2268 @@ .\"- .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" Kenneth Almquist. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" .Dd July 29, 2006 .Dt SH 1 .Os .Sh NAME .Nm sh .Nd command interpreter (shell) .Sh SYNOPSIS .Nm .Op Fl /+abCEefIimnPpsTuVvx .Op Fl /+o Ar longname .Op Fl c Ar string .Op Ar arg ... .Sh DESCRIPTION The .Nm utility is the standard command interpreter for the system. The current version of .Nm is in the process of being changed to conform with the .St -p1003.2 specification for the shell. This version has many features which make it appear similar in some respects to the Korn shell, but it is not a Korn shell clone like pdksh. Only features designated by POSIX, plus a few Berkeley extensions, are being incorporated into this shell. This man page is not intended to be a tutorial nor a complete specification of the shell. .Ss Overview The shell is a command that reads lines from either a file or the terminal, interprets them, and generally executes other commands. It is the program that is started when a user logs into the system, although a user can select a different shell with the .Xr chsh 1 command. The shell implements a language that has flow control constructs, a macro facility that provides a variety of features in addition to data storage, along with built-in history and line editing capabilities. It incorporates many features to aid interactive use and has the advantage that the interpretative language is common to both interactive and non-interactive use (shell scripts). That is, commands can be typed directly to the running shell or can be put into a file, which can be executed directly by the shell. .Ss Invocation .\" .\" XXX This next sentence is incredibly confusing. .\" If no arguments are present and if the standard input of the shell is connected to a terminal (or if the .Fl i option is set), the shell is considered an interactive shell. An interactive shell generally prompts before each command and handles programming and command errors differently (as described below). When first starting, the shell inspects argument 0, and if it begins with a dash .Pq Ql - , the shell is also considered a login shell. This is normally done automatically by the system when the user first logs in. A login shell first reads commands from the files .Pa /etc/profile and then .Pa .profile if they exist. If the environment variable .Ev ENV is set on entry to a shell, or is set in the .Pa .profile of a login shell, the shell then reads commands from the file named in .Ev ENV . Therefore, a user should place commands that are to be executed only at login time in the .Pa .profile file, and commands that are executed for every shell inside the .Ev ENV file. The user can set the .Ev ENV variable to some file by placing the following line in the file .Pa .profile in the home directory, substituting for .Pa .shinit the filename desired: .Pp .Dl ENV=$HOME/.shinit; export ENV .Pp The first non-option argument specified on the command line will be treated as the name of a file from which to read commands (a shell script), and the remaining arguments are set as the positional parameters of the shell ($1, $2, etc). Otherwise, the shell reads commands from its standard input. .Pp Unlike older versions of .Nm the .Ev ENV script is only sourced on invocation of interactive shells. This closes a well-known, and sometimes easily exploitable security hole related to poorly thought out .Ev ENV scripts. .Ss Argument List Processing All of the single letter options to .Nm have a corresponding long name, with the exception of .Fl c and .Fl /+o . These long names are provided next to the single letter options in the descriptions below. The long name for an option may be specified as an argument to the .Fl /+o option of .Nm . Once the shell is running, the long name for an option may be specified as an argument to the .Fl /+o option of the .Ic set built-in command (described later in the section called .Sx Built-in Commands ) . Introducing an option with a dash .Pq Ql - enables the option, while using a plus .Pq Ql + disables the option. A .Dq Li -- or plain .Dq Ql - will stop option processing and will force the remaining words on the command line to be treated as arguments. The .Fl /+o and .Fl c options do not have long names. They take arguments and are described after the single letter options. .Bl -tag -width indent .It Fl a Li allexport Flag variables for export when assignments are made to them. .It Fl b Li notify Enable asynchronous notification of background job completion. (UNIMPLEMENTED) .It Fl C Li noclobber Do not overwrite existing files with .Dq Li > . .It Fl E Li emacs Enable the built-in .Xr emacs 1 command line editor (disables the .Fl V option if it has been set). .It Fl e Li errexit Exit immediately if any untested command fails in non-interactive mode. The exit status of a command is considered to be explicitly tested if the command is part of the list used to control an .Ic if , elif , while , or .Ic until ; if the command is the left hand operand of an .Dq Li && or .Dq Li || operator; or if the command is a pipeline preceded by the .Ic !\& operator. If a shell function is executed and its exit status is explicitly tested, all commands of the function are considered to be tested as well. .It Fl f Li noglob Disable pathname expansion. .It Fl I Li ignoreeof Ignore .Dv EOF Ns ' Ns s from input when in interactive mode. .It Fl i Li interactive Force the shell to behave interactively. .It Fl m Li monitor Turn on job control (set automatically when interactive). .It Fl n Li noexec If not interactive, read commands but do not execute them. This is useful for checking the syntax of shell scripts. .It Fl P Li physical Change the default for the .Ic cd and .Ic pwd commands from .Fl L (logical directory layout) to .Fl P (physical directory layout). .It Fl p Li privileged Turn on privileged mode. This mode is enabled on startup if either the effective user or group id is not equal to the real user or group id. Turning this mode off sets the effective user and group ids to the real user and group ids. When this mode is enabled for interactive shells, the file .Pa /etc/suid_profile is sourced instead of .Pa ~/.profile after .Pa /etc/profile is sourced, and the contents of the .Ev ENV variable are ignored. .It Fl s Li stdin Read commands from standard input (set automatically if no file arguments are present). This option has no effect when set after the shell has already started running (i.e., when set with the .Ic set command). .It Fl T Li trapsasync When waiting for a child, execute traps immediately. If this option is not set, traps are executed after the child exits, as specified in .St -p1003.2 . This nonstandard option is useful for putting guarding shells around children that block signals. The surrounding shell may kill the child or it may just return control to the tty and leave the child alone, like this: .Bd -literal -offset indent sh -T -c "trap 'exit 1' 2 ; some-blocking-program" .Ed .Pp .It Fl u Li nounset Write a message to standard error when attempting to expand a variable that is not set, and if the shell is not interactive, exit immediately. .It Fl V Li vi Enable the built-in .Xr vi 1 command line editor (disables .Fl E if it has been set). .It Fl v Li verbose The shell writes its input to standard error as it is read. Useful for debugging. .It Fl x Li xtrace Write each command -(preceded by the value of the +(preceded by the value of the .Ev PS4 variable) to standard error before it is executed. Useful for debugging. .El .Pp The .Fl c option causes the commands to be read from the .Ar string operand instead of from the standard input. Keep in mind that this option only accepts a single string as its argument, hence multi-word strings must be quoted. .Pp The .Fl /+o option takes as its only argument the long name of an option to be enabled or disabled. For example, the following two invocations of .Nm both enable the built-in .Xr emacs 1 command line editor: .Bd -literal -offset indent set -E set -o emacs .Ed .Pp If used without an argument, the .Fl o option displays the current option settings in a human-readable format. If .Cm +o is used without an argument, the current option settings are output in a format suitable for re-input into the shell. .Ss Lexical Structure The shell reads input in terms of lines from a file and breaks it up into words at whitespace (blanks and tabs), and at certain sequences of characters called .Dq operators , which are special to the shell. There are two types of operators: control operators and redirection operators (their meaning is discussed later). The following is a list of valid operators: .Bl -tag -width indent .It Control operators: .Bl -column "XXX" "XXX" "XXX" "XXX" "XXX" -offset center -compact .It Li & Ta Li && Ta Li ( Ta Li ) Ta Li \en .It Li ;; Ta Li ; Ta Li | Ta Li || .El .It Redirection operators: .Bl -column "XXX" "XXX" "XXX" "XXX" "XXX" -offset center -compact .It Li < Ta Li > Ta Li << Ta Li >> Ta Li <> .It Li <& Ta Li >& Ta Li <<- Ta Li >| .El .El .Pp The character .Ql # introduces a comment if used at the beginning of a word. The word starting with .Ql # and the rest of the line are ignored. .Ss Quoting Quoting is used to remove the special meaning of certain characters or words to the shell, such as operators, whitespace, keywords, or alias names. .Pp There are three types of quoting: matched single quotes, matched double quotes, and backslash. .Bl -tag -width indent .It Single Quotes Enclosing characters in single quotes preserves the literal meaning of all the characters (except single quotes, making it impossible to put single-quotes in a single-quoted string). .It Double Quotes Enclosing characters within double quotes preserves the literal meaning of all characters except dollarsign .Pq Ql $ , backquote .Pq Ql ` , and backslash .Pq Ql \e . The backslash inside double quotes is historically weird. It remains literal unless it precedes the following characters, which it serves to quote: .Bl -column "XXX" "XXX" "XXX" "XXX" "XXX" -offset center -compact .It Li $ Ta Li ` Ta Li \&" Ta Li \e\ Ta Li \en .El .It Backslash A backslash preserves the literal meaning of the following character, with the exception of the newline character .Pq Ql \en . A backslash preceding a newline is treated as a line continuation. .El .Ss Reserved Words Reserved words are words that have special meaning to the shell and are recognized at the beginning of a line and after a control operator. The following are reserved words: .Bl -column "doneXX" "elifXX" "elseXX" "untilXX" "whileX" -offset center .It Li \&! Ta { Ta } Ta Ic case Ta Ic do .It Ic done Ta Ic elif Ta Ic else Ta Ic esac Ta Ic fi .It Ic for Ta Ic if Ta Ic then Ta Ic until Ta Ic while .El .Ss Aliases An alias is a name and corresponding value set using the .Ic alias built-in command. Whenever a reserved word may occur (see above), and after checking for reserved words, the shell checks the word to see if it matches an alias. If it does, it replaces it in the input stream with its value. For example, if there is an alias called .Dq Li lf with the value .Dq Li ls -F , then the input .Bd -literal -offset indent lf foobar .Ed .Pp would become .Bd -literal -offset indent ls -F foobar .Ed .Pp Aliases provide a convenient way for naive users to create shorthands for commands without having to learn how to create functions with arguments. They can also be used to create lexically obscure code. This use is discouraged. .Pp An alias name may be escaped in a command line, so that it is not replaced by its alias value, by using quoting characters within or adjacent to the alias name. This is most often done by prefixing an alias name with a backslash to execute a function, built-in, or normal program with the same name. See the .Sx Quoting subsection. .Ss Commands The shell interprets the words it reads according to a language, the specification of which is outside the scope of this man page (refer to the BNF in the .St -p1003.2 document). Essentially though, a line is read and if the first word of the line (or after a control operator) is not a reserved word, then the shell has recognized a simple command. Otherwise, a complex command or some other special construct may have been recognized. .Ss Simple Commands If a simple command has been recognized, the shell performs the following actions: .Bl -enum .It Leading words of the form .Dq Li name=value are stripped off and assigned to the environment of the simple command. Redirection operators and their arguments (as described below) are stripped off and saved for processing. .It The remaining words are expanded as described in the section called .Sx Word Expansions , and the first remaining word is considered the command name and the command is located. The remaining words are considered the arguments of the command. If no command name resulted, then the .Dq Li name=value variable assignments recognized in 1) affect the current shell. .It Redirections are performed as described in the next section. .El .Ss Redirections Redirections are used to change where a command reads its input or sends its output. In general, redirections open, close, or duplicate an existing reference to a file. The overall format used for redirection is: .Pp .Dl [n] redir-op file .Pp The .Ql redir-op is one of the redirection operators mentioned previously. The following gives some examples of how these operators can be used. Note that stdin and stdout are commonly used abbreviations for standard input and standard output respectively. .Bl -tag -width "1234567890XX" -offset indent .It Li [n]> file redirect stdout (or file descriptor n) to file .It Li [n]>| file same as above, but override the .Fl C option .It Li [n]>> file append stdout (or file descriptor n) to file .It Li [n]< file redirect stdin (or file descriptor n) from file .It Li [n]<> file redirect stdin (or file descriptor n) to and from file .It Li [n1]<&n2 duplicate stdin (or file descriptor n1) from file descriptor n2 .It Li [n]<&- close stdin (or file descriptor n) .It Li [n1]>&n2 duplicate stdout (or file descriptor n1) to file descriptor n2 .It Li [n]>&- close stdout (or file descriptor n) .El .Pp The following redirection is often called a .Dq here-document . .Bd -literal -offset indent [n]<< delimiter here-doc-text ... delimiter .Ed .Pp All the text on successive lines up to the delimiter is saved away and made available to the command on standard input, or file descriptor n if it is specified. If the delimiter as specified on the initial line is quoted, then the here-doc-text is treated literally, otherwise the text is subjected to parameter expansion, command substitution, and arithmetic expansion (as described in the section on .Sx Word Expansions ) . If the operator is .Dq Li <<- instead of .Dq Li << , then leading tabs in the here-doc-text are stripped. .Ss Search and Execution There are three types of commands: shell functions, built-in commands, and normal programs. The command is searched for (by name) in that order. The three types of commands are all executed in a different way. .Pp When a shell function is executed, all of the shell positional parameters (except $0, which remains unchanged) are set to the arguments of the shell function. The variables which are explicitly placed in the environment of the command (by placing assignments to them before the function name) are made local to the function and are set to the values given. Then the command given in the function definition is executed. The positional parameters are restored to their original values when the command completes. This all occurs within the current shell. .Pp Shell built-in commands are executed internally to the shell, without spawning a new process. .Pp Otherwise, if the command name does not match a function or built-in command, the command is searched for as a normal program in the file system (as described in the next section). When a normal program is executed, the shell runs the program, passing the arguments and the environment to the program. If the program is not a normal executable file (i.e., if it does not begin with the .Qq magic number whose .Tn ASCII representation is .Qq #! , resulting in an .Er ENOEXEC return value from .Xr execve 2 ) the shell will interpret the program in a subshell. The child shell will reinitialize itself in this case, so that the effect will be as if a new shell had been invoked to handle the ad-hoc shell script, except that the location of hashed commands located in the parent shell will be remembered by the child. .Pp Note that previous versions of this document and the source code itself misleadingly and sporadically refer to a shell script without a magic number as a .Qq shell procedure . .Ss Path Search When locating a command, the shell first looks to see if it has a shell function by that name. Then it looks for a built-in command by that name. If a built-in command is not found, one of two things happen: .Bl -enum .It Command names containing a slash are simply executed without performing any searches. .It The shell searches each entry in .Ev PATH in turn for the command. The value of the .Ev PATH variable should be a series of entries separated by colons. Each entry consists of a directory name. The current directory may be indicated implicitly by an empty directory name, or explicitly by a single period. .El .Ss Command Exit Status Each command has an exit status that can influence the behavior of other shell commands. The paradigm is that a command exits with zero for normal or success, and non-zero for failure, error, or a false indication. The man page for each command should indicate the various exit codes and what they mean. Additionally, the built-in commands return exit codes, as does an executed shell function. .Pp If a command is terminated by a signal, its exit status is 128 plus the signal number. Signal numbers are defined in the header file .In sys/signal.h . .Ss Complex Commands Complex commands are combinations of simple commands with control operators or reserved words, together creating a larger complex command. More generally, a command is one of the following: .Bl -item -offset indent .It simple command .It pipeline .It list or compound-list .It compound command .It function definition .El .Pp Unless otherwise stated, the exit status of a command is that of the last simple command executed by the command. .Ss Pipelines A pipeline is a sequence of one or more commands separated by the control operator |. The standard output of all but the last command is connected to the standard input of the next command. The standard output of the last command is inherited from the shell, as usual. .Pp The format for a pipeline is: .Pp .Dl [!] command1 [ | command2 ...] .Pp The standard output of command1 is connected to the standard input of command2. The standard input, standard output, or both of a command is considered to be assigned by the pipeline before any redirection specified by redirection operators that are part of the command. .Pp If the pipeline is not in the background (discussed later), the shell waits for all commands to complete. .Pp If the reserved word .Ic !\& does not precede the pipeline, the exit status is the exit status of the last command specified in the pipeline. Otherwise, the exit status is the logical NOT of the exit status of the last command. That is, if the last command returns zero, the exit status is 1; if the last command returns greater than zero, the exit status is zero. .Pp Because pipeline assignment of standard input or standard output or both takes place before redirection, it can be modified by redirection. For example: .Pp .Dl $ command1 2>&1 | command2 .Pp sends both the standard output and standard error of .Ql command1 to the standard input of .Ql command2 . .Pp A .Dq Li \&; or newline terminator causes the preceding AND-OR-list (described below in the section called .Sx Short-Circuit List Operators ) to be executed sequentially; an .Dq Li & causes asynchronous execution of the preceding AND-OR-list. .Pp Note that unlike some other shells, .Nm executes each process in the pipeline as a child of the .Nm process. Shell built-in commands are the exception to this rule. They are executed in the current shell, although they do not affect its environment when used in pipelines. .Ss Background Commands (&) If a command is terminated by the control operator ampersand .Pq Ql & , the shell executes the command asynchronously; the shell does not wait for the command to finish before executing the next command. .Pp The format for running a command in background is: .Bd -literal -offset indent command1 & [command2 & ...] .Ed .Pp If the shell is not interactive, the standard input of an asynchronous command is set to /dev/null. .Ss Lists (Generally Speaking) A list is a sequence of zero or more commands separated by newlines, semicolons, or ampersands, and optionally terminated by one of these three characters. The commands in a list are executed in the order they are written. If command is followed by an ampersand, the shell starts the command and immediately proceeds onto the next command; otherwise it waits for the command to terminate before proceeding to the next one. .Ss Short-Circuit List Operators .Dq Li && and .Dq Li || are AND-OR list operators. .Dq Li && executes the first command, and then executes the second command if the exit status of the first command is zero. .Dq Li || is similar, but executes the second command if the exit status of the first command is nonzero. .Dq Li && and .Dq Li || both have the same priority. .Ss Flow-Control Constructs (if, while, for, case) The syntax of the .Ic if command is: .\" .\" XXX Use .Dl to work around broken handling of .Ic inside .Bd and .Ed . .\" .Dl Ic if Ar list .Dl Ic then Ar list .Dl [ Ic elif Ar list .Dl Ic then Ar list ] ... .Dl [ Ic else Ar list ] .Dl Ic fi .Pp The syntax of the .Ic while command is: .Dl Ic while Ar list .Dl Ic do Ar list .Dl Ic done .Pp The two lists are executed repeatedly while the exit status of the first list is zero. The .Ic until command is similar, but has the word .Ic until in place of .Ic while , which causes it to repeat until the exit status of the first list is zero. .Pp The syntax of the .Ic for command is: .Dl Ic for Ar variable Op Ic in Ar word ... .Dl Ic do Ar list .Dl Ic done .Pp If .Ic in and the following words are omitted, .Ic in Li $@ is used instead. The words are expanded, and then the list is executed repeatedly with the variable set to each word in turn. The .Ic do and .Ic done commands may be replaced with .Dq Li { and .Dq Li } . .Pp The syntax of the .Ic break and .Ic continue commands is: .Dl Ic break Op Ar num .Dl Ic continue Op Ar num .Pp The .Ic break command terminates the .Ar num innermost .Ic for or .Ic while loops. The .Ic continue command continues with the next iteration of the innermost loop. These are implemented as built-in commands. .Pp The syntax of the .Ic case command is .Dl Ic case Ar word Ic in .Dl pattern) list ;; .Dl ... .Dl Ic esac .Pp The pattern can actually be one or more patterns (see .Sx Shell Patterns described later), separated by .Dq Li \&| characters. .Ss Grouping Commands Together Commands may be grouped by writing either .Bd -literal -offset indent (list) .Ed .Pp or .Bd -literal -offset indent { list; } .Ed .Pp The first form executes the commands in a subshell. Note that built-in commands thus executed do not affect the current shell. The second form does not fork another shell, so it is slightly more efficient. Grouping commands together this way allows the user to redirect their output as though they were one program: .Bd -literal -offset indent { echo -n "hello"; echo " world"; } > greeting .Ed .Ss Functions The syntax of a function definition is .Bd -literal -offset indent name ( ) command .Ed .Pp A function definition is an executable statement; when executed it installs a function named name and returns an exit status of zero. The command is normally a list enclosed between .Dq Li { and .Dq Li } . .Pp Variables may be declared to be local to a function by using the .Ic local command. This should appear as the first statement of a function, and the syntax is: .Bd -ragged -offset indent .Ic local .Op Ar variable ... .Op Fl .Ed .Pp The .Ic local command is implemented as a built-in command. .Pp When a variable is made local, it inherits the initial value and exported and readonly flags from the variable with the same name in the surrounding scope, if there is one. Otherwise, the variable is initially unset. The shell uses dynamic scoping, so that if the variable .Em x is made local to function .Em f , which then calls function .Em g , references to the variable .Em x made inside .Em g will refer to the variable .Em x declared inside .Em f , not to the global variable named .Em x . .Pp The only special parameter that can be made local is .Dq Li - . Making .Dq Li - local causes any shell options that are changed via the set command inside the function to be restored to their original values when the function returns. .Pp The syntax of the .Ic return command is .Bd -ragged -offset indent .Ic return .Op Ar exitstatus .Ed .Pp It terminates the current executional scope, returning from the previous nested function, sourced script, or shell instance, in that order. The .Ic return command is implemented as a built-in command. .Ss Variables and Parameters The shell maintains a set of parameters. A parameter denoted by a name is called a variable. When starting up, the shell turns all the environment variables into shell variables. New variables can be set using the form .Bd -literal -offset indent name=value .Ed .Pp Variables set by the user must have a name consisting solely of alphabetics, numerics, and underscores. The first letter of a variable name must not be numeric. A parameter can also be denoted by a number or a special character as explained below. .Ss Positional Parameters A positional parameter is a parameter denoted by a number greater than zero. The shell sets these initially to the values of its command line arguments that follow the name of the shell script. The .Ic set built-in command can also be used to set or reset them. .Ss Special Parameters A special parameter is a parameter denoted by a special one-character name. The special parameters recognized by the .Nm shell of .Fx are shown in the following list, exactly as they would appear in input typed by the user or in the source of a shell script. .Bl -hang .It Li $* Expands to the positional parameters, starting from one. When the expansion occurs within a double-quoted string it expands to a single field with the value of each parameter separated by the first character of the .Ev IFS variable, or by a .Aq space if .Ev IFS is unset. .It Li $@ Expands to the positional parameters, starting from one. When the expansion occurs within double-quotes, each positional parameter expands as a separate argument. If there are no positional parameters, the expansion of .Li @ generates zero arguments, even when .Li @ is double-quoted. What this basically means, for example, is if $1 is .Dq abc and $2 is .Dq def ghi , then .Qq Li $@ expands to the two arguments: .Bd -literal -offset indent "abc" "def ghi" .Ed .It Li $# Expands to the number of positional parameters. .It Li $\&? Expands to the exit status of the most recent pipeline. .It Li $- (hyphen) Expands to the current option flags (the single-letter option names concatenated into a string) as specified on invocation, by the set built-in command, or implicitly by the shell. .It Li $$ Expands to the process ID of the invoked shell. A subshell retains the same value of $ as its parent. .It Li $\&! Expands to the process ID of the most recent background command executed from the current shell. For a pipeline, the process ID is that of the last command in the pipeline. .It Li $0 (zero) Expands to the name of the shell or shell script. .El .Ss Word Expansions This clause describes the various expansions that are performed on words. Not all expansions are performed on every word, as explained later. .Pp Tilde expansions, parameter expansions, command substitutions, arithmetic expansions, and quote removals that occur within a single word expand to a single field. It is only field splitting or pathname expansion that can create multiple fields from a single word. The single exception to this rule is the expansion of the special parameter .Li @ within double-quotes, as was described above. .Pp The order of word expansion is: .Bl -enum .It Tilde Expansion, Parameter Expansion, Command Substitution, Arithmetic Expansion (these all occur at the same time). .It Field Splitting is performed on fields generated by step (1) unless the .Ev IFS variable is null. .It Pathname Expansion (unless the .Fl f option is in effect). .It Quote Removal. .El .Pp The .Dq Li $ character is used to introduce parameter expansion, command substitution, or arithmetic evaluation. .Ss Tilde Expansion (substituting a user's home directory) A word beginning with an unquoted tilde character .Pq Ql ~ is subjected to tilde expansion. All the characters up to a slash .Pq Ql / or the end of the word are treated as a username and are replaced with the user's home directory. If the username is missing (as in ~/foobar), the tilde is replaced with the value of the HOME variable (the current user's home directory). .Ss Parameter Expansion The format for parameter expansion is as follows: .Bd -literal -offset indent ${expression} .Ed .Pp where expression consists of all characters until the matching .Dq Li } . Any .Dq Li } escaped by a backslash or within a quoted string, and characters in embedded arithmetic expansions, command substitutions, and variable expansions, are not examined in determining the matching .Dq Li } . .Pp The simplest form for parameter expansion is: .Bd -literal -offset indent ${parameter} .Ed .Pp The value, if any, of parameter is substituted. .Pp The parameter name or symbol can be enclosed in braces, which are optional except for positional parameters with more than one digit or when parameter is followed by a character that could be interpreted as part of the name. If a parameter expansion occurs inside double-quotes: .Bl -enum .It Pathname expansion is not performed on the results of the expansion. .It Field splitting is not performed on the results of the expansion, with the exception of the special parameter .Li @ . .El .Pp In addition, a parameter expansion can be modified by using one of the following formats. .Bl -tag -width indent .It Li ${parameter:-word} Use Default Values. If parameter is unset or null, the expansion of word is substituted; otherwise, the value of parameter is substituted. .It Li ${parameter:=word} Assign Default Values. If parameter is unset or null, the expansion of word is assigned to parameter. In all cases, the final value of parameter is substituted. Only variables, not positional parameters or special parameters, can be assigned in this way. .It Li ${parameter:?[word]} Indicate Error if Null or Unset. If parameter is unset or null, the expansion of word (or a message indicating it is unset if word is omitted) is written to standard error and the shell exits with a nonzero exit status. Otherwise, the value of parameter is substituted. An interactive shell need not exit. .It Li ${parameter:+word} Use Alternate Value. If parameter is unset or null, null is substituted; otherwise, the expansion of word is substituted. .El .Pp In the parameter expansions shown previously, use of the colon in the format results in a test for a parameter that is unset or null; omission of the colon results in a test for a parameter that is only unset. .Bl -tag -width indent .It Li ${#parameter} String Length. The length in characters of the value of parameter. .El .Pp The following four varieties of parameter expansion provide for substring processing. In each case, pattern matching notation (see .Sx Shell Patterns ) , rather than regular expression notation, is used to evaluate the patterns. If parameter is one of the special parameters .Li * or .Li @ , the result of the expansion is unspecified. Enclosing the full parameter expansion string in double-quotes does not cause the following four varieties of pattern characters to be quoted, whereas quoting characters within the braces has this effect. .Bl -tag -width indent .It Li ${parameter%word} Remove Smallest Suffix Pattern. The word is expanded to produce a pattern. The parameter expansion then results in parameter, with the smallest portion of the suffix matched by the pattern deleted. .It Li ${parameter%%word} Remove Largest Suffix Pattern. The word is expanded to produce a pattern. The parameter expansion then results in parameter, with the largest portion of the suffix matched by the pattern deleted. .It Li ${parameter#word} Remove Smallest Prefix Pattern. The word is expanded to produce a pattern. The parameter expansion then results in parameter, with the smallest portion of the prefix matched by the pattern deleted. .It Li ${parameter##word} Remove Largest Prefix Pattern. The word is expanded to produce a pattern. The parameter expansion then results in parameter, with the largest portion of the prefix matched by the pattern deleted. .El .Ss Command Substitution Command substitution allows the output of a command to be substituted in place of the command name itself. Command substitution occurs when the command is enclosed as follows: .Bd -literal -offset indent $(command) .Ed .Pp or the backquoted version: .Bd -literal -offset indent `command` .Ed .Pp The shell expands the command substitution by executing command in a subshell environment and replacing the command substitution with the standard output of the command, removing sequences of one or more newlines at the end of the substitution. Embedded newlines before the end of the output are not removed; however, during field splitting, they may be translated into spaces depending on the value of .Ev IFS and the quoting that is in effect. .Ss Arithmetic Expansion Arithmetic expansion provides a mechanism for evaluating an arithmetic expression and substituting its value. The format for arithmetic expansion is as follows: .Bd -literal -offset indent $((expression)) .Ed .Pp The expression is treated as if it were in double-quotes, except that a double-quote inside the expression is not treated specially. The shell expands all tokens in the expression for parameter expansion, command substitution, and quote removal. .Pp Next, the shell treats this as an arithmetic expression and substitutes the value of the expression. .Ss White Space Splitting (Field Splitting) After parameter expansion, command substitution, and arithmetic expansion the shell scans the results of expansions and substitutions that did not occur in double-quotes for field splitting and multiple fields can result. .Pp The shell treats each character of the .Ev IFS as a delimiter and uses the delimiters to split the results of parameter expansion and command substitution into fields. .Ss Pathname Expansion (File Name Generation) Unless the .Fl f option is set, file name generation is performed after word splitting is complete. Each word is viewed as a series of patterns, separated by slashes. The process of expansion replaces the word with the names of all existing files whose names can be formed by replacing each pattern with a string that matches the specified pattern. There are two restrictions on this: first, a pattern cannot match a string containing a slash, and second, a pattern cannot match a string starting with a period unless the first character of the pattern is a period. The next section describes the patterns used for both Pathname Expansion and the .Ic case command. .Ss Shell Patterns A pattern consists of normal characters, which match themselves, and meta-characters. The meta-characters are .Dq Li \&! , .Dq Li * , .Dq Li \&? , and .Dq Li [ . These characters lose their special meanings if they are quoted. When command or variable substitution is performed and the dollar sign or back quotes are not double-quoted, the value of the variable or the output of the command is scanned for these characters and they are turned into meta-characters. .Pp An asterisk .Pq Ql * matches any string of characters. A question mark .Pq Ql \&? matches any single character. A left bracket .Pq Ql [ introduces a character class. The end of the character class is indicated by a .Dq Li \&] ; if the .Dq Li \&] is missing then the .Dq Li [ matches a .Dq Li [ rather than introducing a character class. A character class matches any of the characters between the square brackets. A range of characters may be specified using a minus sign. The character class may be complemented by making an exclamation point .Pq Ql !\& the first character of the character class. .Pp To include a .Dq Li \&] in a character class, make it the first character listed (after the .Dq Li \&! , if any). To include a .Dq Li - , make it the first or last character listed. .Ss Built-in Commands This section lists the commands which are built-in because they need to perform some operation that cannot be performed by a separate process. In addition to these, built-in versions of essential utilities are provided for efficiency. .Bl -tag -width indent .It Ic \&: A null command that returns a 0 (true) exit value. .It Ic \&. Ar file The commands in the specified file are read and executed by the shell. The .Ic return command may be used to return to the .Ic \&. command's caller. If .Ar file contains any .Dq / characters, it is used as is. Otherwise, the shell searches the .Ev PATH for the file. If it is not found in the .Ev PATH , it is sought in the current working directory. .It Ic \&[ A built-in equivalent of .Xr test 1 . .It Ic alias Oo Ar name Ns Oo = Ns Ar string Oc ... Oc If .Ar name Ns = Ns Ar string is specified, the shell defines the alias .Ar name with value .Ar string . If just .Ar name is specified, the value of the alias .Ar name is printed. With no arguments, the .Ic alias built-in command prints the names and values of all defined aliases (see .Ic unalias ) . Alias values are written with appropriate quoting so that they are suitable for re-input to the shell. Also see the .Sx Aliases subsection. .It Ic bg Op Ar job ... Continue the specified jobs (or the current job if no jobs are given) in the background. .It Ic builtin Ar cmd Op Ar arg ... Execute the specified built-in command, .Ar cmd . This is useful when the user wishes to override a shell function with the same name as a built-in command. .It Ic bind Oo Fl aeklrsv Oc Oo Ar key Oo Ar command Oc Oc List or alter key bindings for the line editor. This command is documented in .Xr editrc 5 . .It Ic cd Oo Fl L | P Oc Op Ar directory Switch to the specified .Ar directory , or to the directory specified in the .Ev HOME environment variable if no .Ar directory is specified. If .Ar directory does not begin with .Pa / , \&. , or .Pa .. , then the directories listed in the .Ev CDPATH variable will be searched for the specified .Ar directory . If .Ev CDPATH is unset, the current directory is searched. The format of .Ar CDPATH is the same as that of .Ev PATH . In an interactive shell, the .Ic cd command will print out the name of the directory that it actually switched to if this is different from the name that the user gave. These may be different either because the .Ev CDPATH mechanism was used or because a symbolic link was crossed. .Pp If the .Fl P option is specified, .Pa .. is handled physically and symbolic links are resolved before .Pa .. components are processed. If the .Fl L option is specified, .Pa .. is handled logically. This is the default. .It Ic chdir A synonym for the .Ic cd built-in command. .It Ic command Oo Fl p Oc Op Ar utility Op Ar argument ... .It Ic command Oo Fl v | V Oc Op Ar utility The first form of invocation executes the specified .Ar utility as a simple command (see the .Sx Simple Commands section). .Pp If the .Fl p option is specified, the command search is performed using a default value of .Ev PATH that is guaranteed to find all of the standard utilities. .Pp If the .Fl v option is specified, .Ar utility is not executed but a description of its interpretation by the shell is printed. For ordinary commands the output is the path name; for shell built-in commands, shell functions and keywords only the name is written. Aliases are printed as .Dq Ic alias Ar name Ns = Ns Ar value . .Pp The .Fl V option is identical to .Fl v except for the output. It prints .Dq Ar utility Ic is Ar description where .Ar description is either the path name to .Ar utility , a shell builtin, a shell function, a shell keyword or an alias for . Ar value . .It Ic echo Oo Fl e | n Oc Op Ar string ... Print a space-separated list of the arguments to the standard output and append a newline character. .Bl -tag -width indent .It Fl n Suppress the output of the trailing newline. .It Fl e Process C-style backslash escape sequences. .Ic echo understands the following character escapes: .Bl -tag -width indent .It \ea Alert (ring the terminal bell) .It \eb Backspace .It \ec Suppress the trailing newline (this has the side-effect of truncating the line if it is not the last character) .It \ee The ESC character (ASCII 0x1b) .It \ef Formfeed .It \en Newline .It \er Carriage return .It \et Horizontal tab .It \ev Vertical tab .It \e\e Literal backslash .It \e0nnn (Zero) The character whose octal value is nnn .El .Pp If .Ar string is not enclosed in quotes then the backslash itself must be escaped with a backslash to protect it from the shell. For example .Bd -literal -offset indent $ echo -e "a\evb" a b $ echo -e a\e\evb a b $ echo -e "a\e\eb" a\eb $ echo -e a\e\e\e\eb a\eb .Ed .El .Pp Only one of the .Fl e and .Fl n options may be specified. .It Ic eval Ar string ... Concatenate all the arguments with spaces. Then re-parse and execute the command. .It Ic exec Op Ar command Op arg ... Unless .Ar command is omitted, the shell process is replaced with the specified program (which must be a real program, not a shell built-in command or function). Any redirections on the .Ic exec command are marked as permanent, so that they are not undone when the .Ic exec command finishes. .It Ic exit Op Ar exitstatus Terminate the shell process. If .Ar exitstatus is given it is used as the exit status of the shell; otherwise the exit status of the preceding command is used. .It Ic export Ar name ... .It Ic export Op Fl p The specified names are exported so that they will appear in the environment of subsequent commands. The only way to un-export a variable is to .Ic unset it. The shell allows the value of a variable to be set at the same time as it is exported by writing .Bd -literal -offset indent export name=value .Ed .Pp With no arguments the export command lists the names of all exported variables. If the .Fl p option is specified, the exported variables are printed as .Dq Ic export Ar name Ns = Ns Ar value lines, suitable for re-input to the shell. .It Ic false A null command that returns a non-zero (false) exit value. .It Ic fc Oo Fl e Ar editor Oc Op Ar first Op Ar last .It Ic fc Fl l Oo Fl nr Oc Op Ar first Op Ar last .It Ic fc Fl s Oo Ar old Ns = Ns Ar new Oc Op Ar first The .Ic fc built-in command lists, or edits and re-executes, commands previously entered to an interactive shell. .Bl -tag -width indent .It Fl e Ar editor Use the editor named by .Ar editor to edit the commands. The editor string is a command name, subject to search via the .Ev PATH variable. The value in the .Ev FCEDIT variable is used as a default when .Fl e is not specified. If .Ev FCEDIT is null or unset, the value of the .Ev EDITOR variable is used. If .Ev EDITOR is null or unset, .Xr ed 1 is used as the editor. .It Fl l No (ell) List the commands rather than invoking an editor on them. The commands are written in the sequence indicated by the first and last operands, as affected by .Fl r , with each command preceded by the command number. .It Fl n Suppress command numbers when listing with .Fl l . .It Fl r Reverse the order of the commands listed (with .Fl l ) or edited (with neither .Fl l nor .Fl s ) . .It Fl s Re-execute the command without invoking an editor. .It Ar first .It Ar last Select the commands to list or edit. The number of previous commands that can be accessed are determined by the value of the .Ev HISTSIZE variable. The value of .Ar first or .Ar last or both are one of the following: .Bl -tag -width indent .It Ar [+]num A positive number representing a command number; command numbers can be displayed with the .Fl l option. .It Ar -num A negative decimal number representing the command that was executed .Ar num of commands previously. For example, -1 is the immediately previous command. .It Ar string A string indicating the most recently entered command that begins with that string. If the .Ar old=new operand is not also specified with .Fl s , the string form of the first operand cannot contain an embedded equal sign. .El .El .Pp The following environment variables affect the execution of .Ic fc : .Bl -tag -width ".Ev HISTSIZE" .It Ev FCEDIT Name of the editor to use for history editing. .It Ev HISTSIZE The number of previous commands that are accessible. .El .It Ic fg Op Ar job Move the specified .Ar job or the current job to the foreground. .It Ic getopts Ar optstring Ar var The POSIX .Ic getopts command. The .Ic getopts command deprecates the older .Xr getopt 1 command. The first argument should be a series of letters, each possibly followed by a colon which indicates that the option takes an argument. The specified variable is set to the parsed option. The index of the next argument is placed into the shell variable .Ev OPTIND . If an option takes an argument, it is placed into the shell variable .Ev OPTARG . If an invalid option is encountered, .Ev var is set to .Dq Li \&? . It returns a false value (1) when it encounters the end of the options. .It Ic hash Oo Fl rv Oc Op Ar command ... The shell maintains a hash table which remembers the locations of commands. With no arguments whatsoever, the .Ic hash command prints out the contents of this table. Entries which have not been looked at since the last .Ic cd command are marked with an asterisk; it is possible for these entries to be invalid. .Pp With arguments, the .Ic hash command removes each specified .Ar command from the hash table (unless they are functions) and then locates it. With the .Fl v option, .Ic hash prints the locations of the commands as it finds them. The .Fl r option causes the .Ic hash command to delete all the entries in the hash table except for functions. .It Ic jobid Op Ar job Print the process id's of the processes in the specified .Ar job . If the .Ar job argument is omitted, use the current job. .It Ic jobs Oo Fl ls Oc Op Ar job ... Print information about the specified jobs, or all jobs if no .Ar job argument is given. The information printed includes job ID, status and command name. .Pp If the .Fl l option is specified, the PID of each job is also printed. If the .Fl s option is specified, only the PIDs of the jobs are printed, one per line. .It Ic local Oo Ar variable ... Oc Op Fl See the .Sx Functions subsection. .It Ic pwd Op Fl L | P Print the path of the current directory. The built-in command may differ from the program of the same name because the built-in command remembers what the current directory is rather than recomputing it each time. This makes it faster. However, if the current directory is renamed, the built-in version of .Xr pwd 1 will continue to print the old name for the directory. .Pp If the .Fl P option is specified, symbolic links are resolved. If the .Fl L option is specified, the shell's notion of the current directory is printed (symbolic links are not resolved). This is the default. .It Ic read Oo Fl p Ar prompt Oc Oo Fl t Ar timeout Oc Oo Fl er Oc Ar variable ... The .Ar prompt is printed if the .Fl p option is specified and the standard input is a terminal. Then a line is read from the standard input. The trailing newline is deleted from the line and the line is split as described in the section on .Sx White Space Splitting (Field Splitting) above, and the pieces are assigned to the variables in order. If there are more pieces than variables, the remaining pieces (along with the characters in .Ev IFS that separated them) are assigned to the last variable. If there are more variables than pieces, the remaining variables are assigned the null string. .Pp Backslashes are treated specially, unless the .Fl r option is specified. If a backslash is followed by a newline, the backslash and the newline will be deleted. If a backslash is followed by any other character, the backslash will be deleted and the following character will be treated as though it were not in .Ev IFS , even if it is. .Pp If the .Fl t option is specified and the .Ar timeout elapses before any input is supplied, the .Ic read command will return an exit status of 1 without assigning any values. The .Ar timeout value may optionally be followed by one of .Dq s , .Dq m or .Dq h to explicitly specify seconds, minutes or hours. If none is supplied, .Dq s is assumed. .Pp The .Fl e option exists only for backward compatibility with older scripts. .It Ic readonly Oo Fl p Oc Op Ar name ... Each specified .Ar name is marked as read only, so that it cannot be subsequently modified or unset. The shell allows the value of a variable to be set at the same time as it is marked read only by using the following form: .Bd -literal -offset indent readonly name=value .Ed .Pp With no arguments the .Ic readonly command lists the names of all read only variables. If the .Fl p option is specified, the read-only variables are printed as .Dq Ic readonly Ar name Ns = Ns Ar value lines, suitable for re-input to the shell. .It Ic return Op Ar exitstatus See the .Sx Functions subsection. .It Ic set Oo Fl /+abCEefIimnpTuVvx Oc Oo Fl /+o Ar longname Oc Oo .Fl c Ar string Oc Op Fl - Ar arg ... The .Ic set command performs three different functions: .Bl -item .It With no arguments, it lists the values of all shell variables. .It If options are given, either in short form or using the long .Dq Fl /+o Ar longname form, it sets or clears the specified options as described in the section called .Sx Argument List Processing . .It If the .Dq Fl - option is specified, .Ic set will replace the shell's positional parameters with the subsequent arguments. If no arguments follow the .Dq Fl - option, all the positional parameters will be cleared, which is equivalent to executing the command .Dq Li shift $# . The .Dq Fl - flag may be omitted when specifying arguments to be used as positional replacement parameters. This is not recommended, because the first argument may begin with a dash .Pq Ql - or a plus .Pq Ql + , which the .Ic set command will interpret as a request to enable or disable options. .El .It Ic setvar Ar variable Ar value Assigns the specified .Ar value to the specified .Ar variable . .Ic Setvar is intended to be used in functions that assign values to variables whose names are passed as parameters. In general it is better to write .Bd -literal -offset indent variable=value .Ed rather than using .Ic setvar . .It Ic shift Op Ar n Shift the positional parameters .Ar n times, or once if .Ar n is not specified. A shift sets the value of $1 to the value of $2, the value of $2 to the value of $3, and so on, decreasing the value of $# by one. If there are zero positional parameters, shifting does not do anything. .It Ic test A built-in equivalent of .Xr test 1 . .It Ic times Print the amount of time spent executing the shell and its children. The first output line shows the user and system times for the shell itself, the second one contains the user and system times for the children. .It Ic trap Oo Ar action Oc Ar signal ... .It Ic trap Fl l Cause the shell to parse and execute .Ar action when any specified .Ar signal is received. The signals are specified by name or number. In addition, the pseudo-signal .Cm EXIT may be used to specify an action that is performed when the shell terminates. The .Ar action may be an empty string or a dash -.Pq Ar - ; +.Pq Ql - ; the former causes the specified signal to be ignored and the latter causes the default action to be taken. Omitting the .Ar action is another way to request the default action, for compatibility reasons this usage is not recommended though. When the shell forks off a subshell, it resets trapped (but not ignored) signals to the default action. The .Ic trap command has no effect on signals that were ignored on entry to the shell. .Pp Option .Fl l causes the .Ic trap command to display a list of valid signal names. .It Ic true A null command that returns a 0 (true) exit value. .It Ic type Op Ar name ... Interpret each .Ar name as a command and print the resolution of the command search. Possible resolutions are: shell keyword, alias, shell built-in command, command, tracked alias and not found. For aliases the alias expansion is printed; for commands and tracked aliases the complete pathname of the command is printed. .It Ic ulimit Oo Fl HSabcdflmnstuv Oc Op Ar limit Set or display resource limits (see .Xr getrlimit 2 ) . If .Ar limit is specified, the named resource will be set; otherwise the current resource value will be displayed. .Pp If .Fl H is specified, the hard limits will be set or displayed. While everybody is allowed to reduce a hard limit, only the superuser can increase it. The .Fl S option specifies the soft limits instead. When displaying limits, only one of .Fl S or .Fl H can be given. The default is to display the soft limits, and to set both the hard and the soft limits. .Pp Option .Fl a causes the .Ic ulimit command to display all resources. The parameter .Ar limit is not acceptable in this mode. .Pp The remaining options specify which resource value is to be displayed or modified. They are mutually exclusive. .Bl -tag -width indent .It Fl b Ar sbsize The maximum size of socket buffer usage, in bytes. .It Fl c Ar coredumpsize The maximal size of core dump files, in 512-byte blocks. .It Fl d Ar datasize The maximal size of the data segment of a process, in kilobytes. .It Fl f Ar filesize The maximal size of a file, in 512-byte blocks. .It Fl l Ar lockedmem The maximal size of memory that can be locked by a process, in kilobytes. .It Fl m Ar memoryuse The maximal resident set size of a process, in kilobytes. .It Fl n Ar nofiles The maximal number of descriptors that could be opened by a process. .It Fl s Ar stacksize The maximal size of the stack segment, in kilobytes. .It Fl t Ar time The maximal amount of CPU time to be used by each process, in seconds. .It Fl u Ar userproc The maximal number of simultaneous processes for this user ID. .It Fl v Ar virtualmem The maximal virtual size of a process, in kilobytes. .El .It Ic umask Oo Fl S Oc Op Ar mask Set the file creation mask (see .Xr umask 2 ) to the octal or symbolic (see .Xr chmod 1 ) value specified by .Ar mask . If the argument is omitted, the current mask value is printed. If the .Fl S option is specified, the output is symbolic, otherwise the output is octal. .It Ic unalias Oo Fl a Oc Op Ar name ... The specified alias names are removed. If .Fl a is specified, all aliases are removed. .It Ic unset Oo Fl fv Oc Ar name ... The specified variables or functions are unset and unexported. If the .Fl v option is specified or no options are given, the .Ar name arguments are treated as variable names. If the .Fl f option is specified, the .Ar name arguments are treated as function names. .It Ic wait Op Ar job Wait for the specified .Ar job to complete and return the exit status of the last process in the .Ar job . If the argument is omitted, wait for all jobs to complete and return an exit status of zero. .El .Ss Commandline Editing When .Nm is being used interactively from a terminal, the current command and the command history (see .Ic fc in .Sx Built-in Commands ) can be edited using vi-mode command line editing. This mode uses commands similar to a subset of those described in the vi man page. The command .Dq Li set -o vi (or .Dq Li set -V ) enables vi-mode editing and places .Nm into vi insert mode. With vi-mode enabled, .Nm can be switched between insert mode and command mode by typing .Aq ESC . Hitting .Aq return while in command mode will pass the line to the shell. .Pp Similarly, the .Dq Li set -o emacs (or .Dq Li set -E ) command can be used to enable a subset of emacs-style command line editing features. .Sh ENVIRONMENT The following environment variables affect the execution of .Nm : .Bl -tag -width ".Ev HISTSIZE" .It Ev CDPATH The search path used with the .Ic cd built-in. .It Ev EDITOR The fallback editor used with the .Ic fc built-in. If not set, the default editor is .Xr ed 1 . .It Ev FCEDIT The default editor used with the .Ic fc built-in. .It Ev HISTSIZE The number of previous commands that are accessible. .It Ev HOME The starting directory of .Nm . .It Ev IFS Input Field Separators. This is normally set to .Aq space , .Aq tab , and .Aq newline . See the .Sx White Space Splitting section for more details. .It Ev MAIL The name of a mail file, that will be checked for the arrival of new mail. Overridden by .Ev MAILPATH . .It Ev MAILPATH A colon .Pq Ql \&: separated list of file names, for the shell to check for incoming mail. This environment setting overrides the .Ev MAIL setting. There is a maximum of 10 mailboxes that can be monitored at once. .It Ev PATH The default search path for executables. See the .Sx Path Search section for details. .It Ev PS1 The primary prompt string, which defaults to .Dq Li "$ " , unless you are the superuser, in which case it defaults to .Dq Li "# " . .It Ev PS2 The secondary prompt string, which defaults to .Dq Li "> " . .It Ev PS4 The prefix for the trace output (if .Fl x is active). The default is .Dq Li "+ " . .It Ev TERM The default terminal setting for the shell. This is inherited by children of the shell, and is used in the history editing modes. .El .Sh EXIT STATUS Errors that are detected by the shell, such as a syntax error, will cause the shell to exit with a non-zero exit status. If the shell is not an interactive shell, the execution of the shell file will be aborted. Otherwise the shell will return the exit status of the last command executed, or if the exit builtin is used with a numeric argument, it will return the argument. .Sh SEE ALSO .Xr builtin 1 , .Xr chsh 1 , .Xr echo 1 , .Xr ed 1 , .Xr emacs 1 , .Xr expr 1 , .Xr getopt 1 , .Xr pwd 1 , .Xr test 1 , .Xr vi 1 , .Xr execve 2 , .Xr getrlimit 2 , .Xr umask 2 , .Xr editrc 5 .Sh HISTORY A .Nm command, the Thompson shell, appeared in .At v1 . It was superseded in .At v7 by the Bourne shell, which inherited the name .Nm . .Pp This version of .Nm was rewritten in 1989 under the .Bx license after the Bourne shell from .At V.4 . .Sh AUTHORS This version of .Nm -was originally written by Kenneth Almquist. +was originally written by +.An Kenneth Almquist . .Sh BUGS The .Nm utility does not recognize multibyte characters.