home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-09-15 | 60.8 KB | 1,807 lines |
- #name overview
- #whatis overview - DOS command line processing
-
- On DOS systems, command line processing is normally provided
- by command.com (or cmd.exe on NT systems). This is broadly
- equivalent to a Shell command interpreter on UNIX systems
- (e.g., /bin/sh), though it is much more limited in almost
- every way. The following list provides a summary of the
- main features of DOS command processing:
-
- Parameter Substitution
- Parameter substitution is delimited by percent
- characters (i.e. %var%). These substitutions occur
- anywhere on the command line, including within quoted
- strings. For example:
-
- set x=/usr/bin
- echo %x%
-
- is equivalent to:
-
- x=/usr/bin
- echo $x
-
- on a UNIX system. Within a quoted string, the %
- character can be escaped by typing %%.
-
- Command Substitution
- None provided (aka $(command) or `command` on UNIX
- systems).
-
- Arithmetic Substitution
- None provided (aka $((expression)) on UNIX systems).
-
- Quoting
- Command arguments are quoted on DOS using double-quote
- characters; single-quotes are not recognized. Within
- quoted strings, parameter substitutions still occur
- unless escaped. Double-quotes appearing literally in
- a quoted string can be escaped by preceding them with
- a backslash character. For example:
-
- grep "#include \"head.h\"" *.c
-
- will display lines from all C source files in the
- current directory containing the character sequence:
-
- #include "head.h"
-
- History Substitutions
- A command history mechanism is provided by the
- "doskey" program. This can be started from a batch
- file (e.g., autoexec.bat) or directly from the command
- line. Doskey provides a command macro capability, a
- command history mechanism, and command line editing.
- Type "doskey /?" for details.
-
- Line Continuation
- None. The DOS command interpreter executes the
- command line as soon as you hit Enter, irrespective of
- whether or not the input line is complete; that is,
- there is no equivalent of the PS2 line continuation
- prompt on UNIX.
-
- Input/Output Redirection
- DOS supports input redirection using the "<file"
- syntax, and output redirections using ">file" or
- ">>file". It does not support here-is files ("<<eof"
- on UNIX) or redirection of specific file descriptors
- (e.g., "2>&1" on UNIX), so stderr cannot be
- redirected.
-
- File Name Expansion
- On UNIX systems, file name expansion is performed by
- the Shell; on DOS systems, it is performed by the
- called program itself. The WinXs commands perform
- wild-card expansions on tokens appearing as file
- names, but not on those appearing as option arguments
- (see "man syntax" and "man filenames" for details).
- Other commands may expand file names differently.
-
- #name config
- #whatis config - configuring the command line tools
-
- The WinXs command line tools are made available by adding
- the appropriate WinXs directory to your environment search
- path. This is done by adding or modifing a call to the PATH
- command in the autoexec.bat file. For example,
-
- PATH c:\winxs\bin;c:\windows;c:\dos
-
- This identifies three directories that will be searched
- automatically when entering a command at the command prompt;
- namely, "c:\winxs\bin", "c:\windows", and "c:\dos". The
- exact nature of this command will vary from system to
- system, so you should check your current setting before
- making any changes.
-
- Note that "winxs" in the above example is the name of the
- directory where you installed WinXs. The command line tools
- are located in the "bin" subdirectory below this directory.
-
- #name syntax
- #whatis syntax - command line syntax
-
- All WinXs command line tools follow the same general syntax,
- i.e.,
-
- name [options] [files]
-
- where name is the command name, options is one or more
- keyword options introduced by a hyphen, and files names one
- or more input files. Not all commands support both options
- and files, but where they are supported, the syntax that
- applies to them is always the same.
-
- Note that square brackets in a command line specification
- indicate an optional element; ellipsis (...) indicate that
- the previous command line element can be repeated any number
- of times. For example:
-
- foo [-abc] [-o file] [file ...]
-
- Identifies a mythical command named "foo", which will accept
- three single key options (-a, -b and -c), an option -o that
- is followed by a file name, and the names of zero, one or
- more input files. Generally, if no files are specified,
- input is taken from the standard input stream. Output is
- almost always written to the standard output stream unless
- redirected.
-
- Because of this use of standard input and standard output,
- the WinXs commands can be used freely in command pipelines.
- For example,
-
- nl -ba -nrz -s# file1 | sort -rn | sed "s/^[0-9]*#//"
-
- will reverse the lines in a text file (file1) and write the
- results to standard output (normally the console).
-
- #name options
- #whatis options - specifying command options
-
- Command options are introduced by a hyphen (-), which may be
- followed by one or more keys. Keys can be specified
- collectively after a single hyphen, or they can be specified
- individually. For example, the following invocations of the
- foo command are considered equivalent:
-
- foo -abc
- foo -ab -c
- foo -a -bc
- foo -a -b -c
-
- The order in which option keys are specified is not
- generally significant, unless the key is defined to be
- followed by a value (e.g., [-o file]). In this case, the
- value must immediately follow the key, which may or may not
- be separated by one or more blanks (space or tab). So, for
- example,
-
- foo -o outfile
- foo -ooutfile
-
- are again treated as equivalent. Note, however, that any
- other option following a value must be introduced by another
- hyphen, as in:
-
- foo -o outfile -a
-
- Note also that file name expansion (see the next section) is
- not performed on option values, so file names appearing as
- option values cannot contain wild-card characters.
-
- #name filenames
- #whatis filenames - file name expansion
-
- The WinXs command line tools provide automatic file name
- expansion for names appearing in the [file] element of a
- command line. The following wild-card characters are
- recognised:
-
- * Any character or group of characters.
-
- ? Any single character.
-
- So, for example:
-
- foo -a *.txt
-
- will expand to all file names in the current directory with
- a .txt extension.
-
- foo -a ../*.txt
-
- will expand to all file names in the parent directory with a
- .txt extension
-
- Note that the WinXs tools accept either the DOS separator
- character (\) in file names, or the UNIX separator character
- (/). Path names appearing in command lines may be relative
- (e.g., ../../foobar) or absolute (e.g., c:\winxs\*.txt), but
- only file name elements may contain wild-card characters.
-
- (Note. On Windows 95, specifying "*" on its own will expand
- to a list of all files in the selected directory. On
- Windows 3.x, this will expand to a list of files with no
- extensions. Use "*.*" on Windows 3.x to select all files.)
-
- #name cat
- #whatis cat - concatenate files
-
- cat [-su] [-v[te]] [file ...]
-
- cat accepts the following options:
-
- -s Does not produce an error message on failure
-
- -u Does not buffer output
-
- -v Displays all characters, including those that are
- unprintable. When displaying unprintable characters,
- ^c is used for the control characters, and \xxx for
- 8-bit characters (where xxx represents the octal value
- of the character).
-
- -t Displays tabs as ^I.
-
- -e Displays a $ character at the end of each line.
-
- cat writes its output to standard output, and reads its
- input from standard input if no file is specified.
-
- #name cksum
- #whatis cksum - write file checksums and sizes
-
- cksum [file ...]
-
- cksum calculates a cyclic redundacy check (CRC) for each
- input file, which it writes along with the size of the file
- (in bytes) to standard output. Standard input is used if no
- file operands are specified on the command line.
-
- Typically, this utility is used to check the integrity of
- files received from other systems; that is, the CRC of a
- file should be the same on both systems.
-
- #name cmp
- #whatis cmp - compare binary files
-
- cmp [-s] file1 file2
-
- cmp accepts the following options:
-
- -s Does not produce an error message on failure. The
- exist status can be used to determine the success or
- otherwise of the command (i.e., 0 = files are
- identical, 1 = files are different, 2 = failure).
-
- #name col
- #whatis col - filter reverse line feeds
-
- col [-bfpx] [-t tabstop] [file ...]
-
- col accepts the following options:
-
- -b Filter backspaces.
-
- -f Allow forward half-line feeds.
-
- -p Ignore unknown escapes.
-
- -t tabstop
- Sets the number of column positions for tab conversion
- (default 8).
-
- -x No space to tab conversion.
-
- col writes its output to standard output, and reads its
- input from standard input if no file is specified.
-
- #name comm
- #whatis comm - select or reject lines common to two files
-
- comm [-123] file1 file2
-
- comm accepts the following options:
-
- -1 Suppress the output of lines unique to file1.
-
- -2 Suppress the output of lines unique to file2.
-
- -3 Suppress the output of lines common to both files.
-
- comm reads file1 and file2, which should be sorted
- alphabetically, and produces three columns of output; lines
- only in file1, lines only in file2, and lines common to both
- files. Any or all of these columns can be suppressed.
-
- #name compress
- #whatis compress - compress data in a file or files
-
- compress [-cd] [file ...]
-
- compress accepts the following options:
-
- -c cat output. Normally compress will compress the named
- files in place. If this option is specified, the
- output is written to standard output instead.
-
- -d Decompress. The input files are uncompressed rather
- than compressed.
-
- If file is not specified, the input is read from standard
- input and the output is written to standard output.
-
- #name cp
- #whatis cp - copy files
-
- cp [-fip] source_file target_file
- cp [-fip] source_file ... directory
- cp -R [-fip] source_file ... directory
- cp -r [-fip] source_file ... directory
-
- cp accepts the following options:
-
- -f If a target_file exists, remove it before attempting
- to copy the source_file. This includes removing
- Read-only files.
-
- -i If a target_file exists, prompt the user for
- confirmation before attempting the copy operation.
- Whether or not this option is specified, source_file
- will not be copied if the target_file is Read-only.
- Use the -f option to force a copy in this case.
-
- -p In addition to copying the data of source_file, also
- copy the file mode, access time and modification time.
- If this option is not specified, the mode of the
- target file will be set to read and write, and the
- file access times will be set to the time at which the
- copy took place.
-
- -R Copy file hierarchies. When this option is set, and
- if source_file identifies a directory, the entire
- directory structure rooted at source_file will be
- copied to the target directory.
-
- -r Same as -R.
-
- In the first form, source_file is simply copied to
- target_file, neither of which can identify a directory. The
- target file will be created if it does not already exist.
-
- In the second form, where neither -R or -r is specified,
- each of the source_files is copied to the target directory.
- It is an error if any source_file is a directory, if the
- target directory does not exist, or if the target is not a
- directory.
-
- In the third and fourth forms, where -R or -r is specified,
- the cp utility will copy each source_file to the target
- directory, creating the target directory if it does not
- already exist. When -R or -r is specified, source_file can
- identify either a file or a directory.
-
- #name csplit
- #whatis csplit - split files based on context
-
- csplit [-s] [-f prefix] [-n number] file arg1 ... argn
-
- csplit accepts the following options:
-
- -s Suppress the output of file size messages
-
- -f Prefix.
-
- -n Number of digits in generated file names.
-
- #name cut
- #whatis cut - cut out selected fields from each line of a file
-
- cut -b list [-n] [file ...]
- cut -c list [file ...]
- cut -f list [-d delim] [-s] [file ...]
-
- cut accepts the following options:
-
- -b list
- Cut based on a list of bytes. List contains one or
- more comma or blank separated elements. Each element
- of the list has the form: low-high (cut from "low"
- byte to "high" byte), -high (cut from byte 1 to "high"
- byte), or low- (but from "low" byte to the last byte
- in each line).
-
- -c list
- Same as "-b list".
-
- -f list
- Cut based on a list of fields, where each input field
- is separated by the delim character (see "-d" below).
- Output fields will be separated by a single instance
- of delim. Lines with no field delimiters will be
- passed through intact, unless "-s" is specified.
- "list" has the same meaning as described above, except
- that "low" and "high" refer to field numbers (starting
- at 1) rather than bytes.
-
- -d delim
- Set the field delimiter to the character "delim" (tab
- by default).
-
- -n Ignored (reserved for future use).
-
- -s Suppress the output of lines with no delimiter
- characters.
-
- The cut utility will cut bytes (-b or -c option) or
- character delimited fields (-f option) from each line of one
- or more input files, concatenate them and write the results
- to standard output. Standard input is used if no files are
- specified on the command line.
-
- #name dd
- #whatis dd - convert and copy a file
-
- dd [bs=expr] [cbs=expr] [conv=value[,value...]] [count=n]
- [ibs=expr] [if=file] [obs=expr] [of=file] [seek=n] [skip=n]
-
- dd accepts the following operands:
-
- if=file Specifies the input file name (standard input by
- default).
-
- of=file Specifies the output file name (standard output
- by default).
-
- bs=expr Set input and output block size, which
- supersedes any settings of ibs= or obs=. "expr"
- can be: a decimal number, indicating bytes; a
- decimal number followed by k, indicating
- kilobytes; a decimal number followed by b,
- indicating 512-byte blocks; two or more decimal
- numbers separated by x, indicating the product
- of the specified values.
-
- ibs=expr Specify the input block size (default 512
- bytes).
-
- obs=expr Specify the output block size (default 512
- bytes).
-
- cbs=expr Specify the conversion block size for
- block/unblock conversions.
-
- skip=n Skip "n" input blocks before starting the copy.
-
- seek=n Skip "n" output blocks from the beginning of the
- output file before copying.
-
- count=n Copy only n input blocks"
-
- conv=value Where "value"s are comma-separated symbols from
- the following list:
-
- ascii convert input characters from EBCDIC to
- ASCII.
-
- ebcdic convert input characters from ASCII to
- EBCDIC.
-
- ibm convert input characters from ASCII to a
- different EBCDIC set.
-
- block treat the input as variable length
- records separated by newline characters,
- and convert each input record to a fixed
- length output record equal to the
- conversion block size, padding with
- space characters if necessary.
-
- unblock treat the input as fixed length records
- of conversion block size, and convert
- each input record to a variable length
- output record, removing spaces from the
- end of each input line as necessary.
-
- lcase map upper-case characters in the input
- to their corresponding lower-case
- character.
-
- ucase map lower-case characters in the input
- to their corresponding upper-case
- character.
-
- swab swap every pair of input bytes.
-
- noerror do not stop processing on input error.
-
- notrunc do not truncate the output file if it
- already exists.
-
- sync pad every input block to the size of the
- input block size, appending null bytes
- as necessary (or space characters if
- either block or unblock is specified).
-
- The dd utility copies the specified input file to the
- specified output file with possible conversions, using
- specific input and output block sizes. One input block is
- read at a time, conversions are applied (if any), and the
- block is written to the output in the specified block size.
-
- #name df
- #whatis df - report free disk space
-
- df [-kPt] [file ...]
-
- df accepts the following options:
-
- -k Use 1024-byte units, instead of the default 512-byte
- units, when writing space figures.
-
- -P Produce output in the portable format defined by POSIX
- (default).
-
- -t Include total allocated space figures in the output
- (default).
-
- The df utility writes out various information about the
- drives containing the indicated files, including:
-
- + Drive number (Filesystem).
-
- + Total disk space in 512-byte (default) or 1024-byte
- units.
-
- + Used disk space in 512-byte (default) or 1024-byte
- units.
-
- + Available disk space in 512-byte (default) or 1024-byte
- units.
-
- + Capacity in terms of the percentage of space used.
-
- + Mount point of the file-system.
-
- If no file operand is specified, statistics are produced for
- the current drive (This is different to the UNIX version of
- df, which produces statistics for all mounted drives. A
- similar effect is difficult to achieve on a DOS system, as
- DOS contains nothing equivalent to the UNIX mount table.)
-
- #name diff
- #whatis diff - compare files
-
- diff [-abei] [-CN] file1 file2
-
- diff accepts the following options:
-
- -a Text file. Diff first attempts to determine if the
- files being compared are text files or binary files.
- If the latter, they are compared using the "cmp"
- utility. Setting this option forces a text file
- comparison.
-
- -b Ignore white-space in text file comparisons.
-
- -e Output differences in a form that is suitable as input
- to the "sed" utility.
-
- -i Ignore case in text file comparisons.
-
- -C Indicates the number of text lines that should be
- matched to re-synchronize file1 and file2 after a
- difference has been detected (default 3). This value
- can also be set via the DIFFC environment variable
- (e.g. "set DIFFC=3").
-
- #name dos2unix
- #whatis dos2unix - convert text file from DOS to UNIX format
-
- dos2unix [-o output] file ...
-
- dos2unix accepts the following options:
-
- -o Normally dos2unix converts files in place. If this
- option is specified, and output names a file, all the
- input is converted and appended to the named file; if
- it names a directory, the input files are copied to
- the named directory and then converted. If file names
- a directory, this option must be specified and output
- must also identify a directory.
-
- #name dircmp
- #whatis dircmp - compare the contents of two directories
-
- dircmp [-rd] dir1 dir2
-
- dircmp accepts the following options:
-
- -d Compare the contents of files with the same name using
- diff, and output a list indicating what must be
- changed in the two files to make them the same (see
- diff for more details). If this option is not
- specified, files with the same name are compared using
- cmp.
-
- -r Recursive. When this option is specified, dircmp
- compares the directory hierarchies rooted at dir1 and
- dir2, including all subdirectories and subfiles.
-
- The dircmp command line utility examines the directories
- specified by dir1 and dir2 and generates various tabulated
- information about their contents. Where the same file exists
- in both directories, or subdirectories if -r is specified,
- either a binary comparison will be performed, or diff will
- be invoked to perform the comparison if the -d option is
- specified. Where a file only exists in one directory or
- another, a line will be output giving the name of that file
- and the name of the directory in which it exists.
-
- dircmp uses the PATH environment variable to locate cmp and
- diff. If the WinXs "bin" directory has not been added to
- PATH, dircmp will not work correctly.
-
-
- #name du
- #whatis du - estimate file space usage
-
- du [-a | -s] [-ku] [file ...]
-
- du accepts the following options:
-
- -a List all files.
-
- -s Exclude sub-directories.
-
- -k Display file sizes in 1024 byte units, rather than the
- default 512 byte units
-
- -u Attempt to determine the size of file-system clusters
- and display file sizes in these units. This option
- also causes a space utilization figure to be displayed
- as a percentage of used space vs allocated space.
-
- By default, du displays the amount of file space allocated
- to each identified file or directory. If a directory is
- specified, du displays the amount of space allocated to the
- file hierarchy rooted at the specified directory and each of
- its subdirectories (unless -s is also specified); specifying
- -a causes the space allocated to all files in the directory
- hierarchy to be displayed. If the file argument is omitted,
- the current directory is used as the default. Output is
- always written to standard output.
-
- #name expand
- #whatis expand - convert tabs to spaces
-
- expand [-t tabstop] [file ...]
-
- expand accepts the following options:
-
- -t Tab length.
-
- expand writes its output to standard output, and reads its
- input from standard input if no file is specified.
-
- #name file
- #whatis file - determine file type
-
- file file ...
-
- The command line version of file attempts to determine file
- types using magic numbers only.
-
- #name find
- #whatis find - find files
-
- find path ... [expression]
-
- find accepts the following options:
-
- path Names one or more directories from which to
- begin searching for files that match expression.
-
- Expression An expression is made up of primaries and
- operators that are matched against all files and
- directories in the directory hierarchy named by
- path (see below for details).
-
- The find command line utility will recursively descend the
- directory hierarchy starting at the directory specified by
- path, and find files that match the criteria specified by
- expression.
-
- find builds expression from a set of primaries and
- operators. The first argument that begins with a '-' (minus
- sign), '!' (the NOT operator), or '(' (left parenthesis) is
- interpreted as the start of expression.
-
- Operators
-
- Primaries can be combined with the following operators,
- presented in order of decreasing precedence:
-
- ( expression )
- True if expression is true. Parenthesis are used for
- grouping primaries, for example:
-
- find . ( ( -name tmp -o -name temp ) -prune ) -o -print
-
- will print the names of all files in the directory
- hierarchy starting from the current directory, except
- for files in directories named "tmp" or "temp".
- Without the parenthesis, nothing would be printed.
-
- ! expression
- The unary NOT operator, which negates the following
- primary.
-
- expression [-a] expression
- Conjunction of primaries. The AND operator is implied
- by the juxtaposition of two primaries or made explicit
- by the -a operator. The second expression will not be
- evaluated if the first expression is false.
-
- expression -o expression
- Alternative primaries. With the OR operator, the
- second expression will not be evaluated if the first
- expression is true.
-
- Note that the AND and OR operators are considered to have
- equal precedence and group from left to right.
-
- Primaries
-
- The following primaries are supported:
-
- -name pattern
- This primary will evaluate as true if the last element
- of the file name being examined matches pattern, which
- is a file name pattern possibly containing DOS wild-
- card characters. For example:
-
- find . -name *.c -o -name *.h
-
- will match (and print the names of) all files
- containing the extensions ".c" or ".h". Note that
- primaries and expressions appearing on the command
- line must be separated by at least one white-space
- character (space or tab).
-
- -newer file
- This primary will evaluate as true if the file being
- examined was modified more recently than file. file
- is only evaluated once, when the command is first
- invoked.
-
- -prune
- This primary always evaluates as true. Its effect is
- to cause find not to descend the current path name if
- it is a directory. If -depth is also specified,
- -prune has no effect.
-
- -perm mode
- The mode argument is used to check for specific file
- modes, and can be one of "r" (read-only file) or "w"
- (read and write file). Thus to check for all read-
- only files on the current drive, use:
-
- find / -perm r
-
- Note that path names can be specified using either
- backslash or forward slash characters.
-
- -size [+/-]n
- This primary will evaluate as true if the size of the
- current file matches n bytes as follows:
-
- -n True if the current file is smaller than n
- bytes.
-
- +n True if the current file is larger than n bytes.
-
- n Trues if the size of the current file is exactly
- n bytes.
-
- n can be followed by the letter 'k' to indicate
- kilobytes, or the letter 'm' to indicate megabytes.
- Otherwise n is assumed to represent bytes.
-
- To find all files on drive C larger than 1 megabyte,
- use any of the following commands:
-
- find c:/ -size +1024000
- find c:/ -size +1024k
- find c:/ -size +1m
-
- -type type
- This primary will evaluate as true if the current file
- matches type, which can be one of "f" (file) or "d"
- (directory). To list all the directories below the
- current working directory, use a command of the form:
-
- find . -type d
-
- -mtime [+/-]n
- This primary will evaluate as true if the current file
- modification time matches n as follows:
-
- -n True if the current file modification time is
- less than n days old.
-
- +n True if the current file modification time is
- more than n days old.
-
- n True if the current file modification time is
- exactly n days old, where n is measured in 24-
- hour periods (e.g., 0=today, 1=yesterday, etc.).
-
- n can be followed by the letter 'h' to indicate hours,
- or the letter 'm' to indicate minutes. Otherwise n is
- assumed to represent days.
-
- To check for all files on the current drive that have
- been modified in the last 24 hours, use the command:
-
- find / -mtime -1
-
- -exec utility [argument ...] ;
- This primary will invoke the utility named by utility
- with the indicated arguments. The end of the primary
- must be punctuated by a ; (semi-colon), separated from
- the last argument by one or more space characters. A
- utility name or argument containing only the
- characters {} will be replaced by the current path
- name. For example:
-
- find . -name *.c -exec ls -l {} ;
-
- will search for all files with the suffix ".c" and
- call the ls utility for each one, passing the current
- path name as the input file name to ls.
-
- This primary returns true if utility returns a zero
- exit status; otherwise it returns false.
-
- -ok utility [argument ...] ;
- This primary is equivalent to -exec, except that find
- will display the command line before executing it, and
- request affirmation that it is to be executed.
-
- -print
- This primary always evaluates to true and causes the
- current path name to be written to standard output.
-
- -depth
- This primary always evaluates to true and causes
- descent of the directory hierarchy to be done so that
- all directory entries are acted on before the
- directory itself. By default, the directory itself is
- acted on first, followed by the entries in that
- directory. To see the difference this primary makes,
- run the following two commands and note the different
- output:
-
- find /
- find / -depth
-
- If no expression is present, -print will be used as the
- expression. Also, if the given expression does not contain
- one of the primaries -print, -exec or -ok, the given
- expression will, in effect, be replaced by:
-
- ( expression ) -print
-
- #name fmt
- #whatis fmt - simple text formatter
-
- fmt [-j] [-b|C|c|i] [-w width] [file ...]
-
- fmt accepts the following options:
-
- -j Justify text.
-
- -b Block paragraphs.
-
- -C Centred paragraphs.
-
- -c Crown paragraphs.
-
- -I Indented paragraphs.
-
- -w Line width.
-
- fmt writes its output to standard output, and reads its
- input from standard input if no file is specified.
-
- #name fold
- #whatis fold - break lines in text files
-
- fold [-bs] [-w width] [file ...]
-
- fold accepts the following options:
-
- -b Measure line widths in bytes. Otherwise, line widths
- are measured in column positions, after tab, backspace
- and carriage return processing.
-
- -s Break lines at the last blank character (space or tab)
- within width column positions (or bytes).
-
- -w Line width in column positions (or bytes). The
- default, if this argument is not specified, is 80.
-
- fold writes its output to standard output, and reads its
- input from standard input if no file is specified.
-
- #name grep
- #whatis grep - search a file or files for a pattern
-
- grep [-E|-F] [-cilnqsvx] [-f pattern_file]... -e pattern...
- [file ...]
- grep [-E|-F] [-cilnqsvx] [-e pattern]... -f pattern_file...
- [file ...]
- grep [-E|-F] [-cilnqsvx] pattern... [file ...]
-
- grep accepts the following options:
-
- -E Reserved for future use.
-
- -F Match using fixed strings. Regard each pattern as a
- fixed string instead of a regular expression.
-
- -c Write only a count of selected lines.
-
- -e Add pattern to the list of patterns to be matched
- against the input. Use this option to specify multiple
- patterns on the command line.
-
- -f Read one or more patterns from pattern_file and add
- them to the list of patterns to be matched against the
- input.
-
- -i Ignore case.
-
- -l Write only the names of files containing matching
- lines to standard output. Path names are written once
- per file searched.
-
- -n Display line numbers.
-
- -q Quiet. Exit with zero status if input line is
- matched. No output is written.
-
- -s Suppress the writing of error messages.
-
- -v Display unmatched lines.
-
- -x Match only input lines that use all the characters in
- the line to match an entire fixed string or regular
- expression.
-
- If no -e or -f option is present, the first argument after
- the options is assumed to contain a pattern for matching
- against the input. grep writes its output to standard
- output, and reads its input from standard input if no file
- is specified.
-
- #name head
- #whatis head - display the first part of a file
-
- head [-s number] [-n lines] [file ...]
-
- head accepts the following options:
-
- -s Skip number input lines.
-
- -n Display lines (default 10) from the start of each
- input file.
-
- head writes its output to standard output, and reads input
- from standard input if no file is specified.
-
- #name join
- #whatis join - join files
-
- join [-a N | -v N] [-e string] [-o list] [-t char]
- [-1 field] [-2 field] file1 file2
-
- join accepts the following options:
-
- -a N Write an output line for each unpairable line in file
- "N", where "N" can be 1 or 2, in addition to the
- default output. If both "-a1" and "-a2" are
- specified, all unpairable lines are output.
-
- -e string
- Replace empty output fields with "string" in the list
- selected by "-o".
-
- -o list
- Construct the output line as defined by "list", each
- element of which specifies either "0" (the join field)
- or "file.field", where "file" is the file number (1 or
- 2) and "field" is an integer field number (starting at
- 1). Elements in list can be separated by commas or
- blanks.
-
- -t char
- Use character "char" as the field separator for both
- input and output. By default, the input field
- separator is one or more blank characters; the output
- field separator is a single space character. When "-
- t" is specified, each appearance of "char" is regarded
- as significant.
-
- -v N Instead of the default output, produce only a line for
- each unpairable line in file number "N". If both "-
- v1" and "-v2" are specified, all unpairable lines are
- output.
-
- -1 field
- Join on the "field"th field of file 1 (field 1 by
- default).
-
- -2 field
- Join on the "field"th field of file 2 (field 1 by
- default).
-
- The join utility performs an equality join on fields within
- file1 and file2. By default, the first field of each input
- line is used as the join field, where field1 of file1 is
- compared with field1 of file2. When the join fields compare
- equal (i.e., they are paired), the default output consists
- of the join field, the remaining fields from file1, followed
- by the remaining fields from file2, with each field being
- separated by a single space character. file1 and file2
- should be sorted alphabetically.
-
- #name ls
- #whatis ls - list directory contents
-
- ls [-CFLRadlmprtx1] [file ...]
-
- ls accepts the following options:
-
- -C Write multi-column output with entries sorted down the
- columns.
-
- -F Write a slash character (/) immediately after each
- name that is a directory.
-
- -L Display long file names exactly as they appear in
- filestore (32-bit version only).
-
- -R Recursively list sub-directories as they are
- encountered.
-
- -a Write out all directory entries. By default, entries
- beginning with a dot (.) are not listed.
-
- -d List directory names rather than their contents. -R
- is ignored if -d is specified.
-
- -l Long format listing. This produces a separate line of
- output for each file, containing: file mode, owner
- name, group, file size (in bytes), date and time of
- last file update, file name. The file mode is defined
- as per UNIX, but note that the group and other
- permissions are artificial on a Windows system. The
- owner is always "root" on Windows, and the group is
- always 0.
-
- -m Stream output format; file names are listed across the
- screen, separated by commas.
-
- -p Same as -F.
-
- -r Reverse the sort order to get reverse collating
- sequence or oldest first.
-
- -t Sort by time modified (most recently modified first).
- This ordering is reversed if -r is also specified.
- (Warning. Time sorting can take a few seconds when
- listing directories containing a large number of
- files).
-
- -x Write multi-column output with entries sorted across
- the columns. This is the default listing mode if
- neither -C, -l, -x or -1 is specified, and the output
- device is the console.
-
- -1 (The number one.) Force single column output.
-
- For each operand that names a file (possibly containing
- wild-card characters), the ls command line utility writes
- the name of the file or files to standard output with any
- associated information requested by the options. For each
- operand that names a directory, ls writes the names of all
- files contained in that directory to standard output, again
- with any requested, associated information.
-
- If no files are specified, the contents of the current
- directory are written. If more that one file is specified,
- ls processes each file name as though each had been passed
- to a separate invocation of ls.
-
- If no options are specified, -x is assumed; that is, ls will
- produce a multi-column listing with entries sorted across
- columns.
-
- #name man
- #whatis man - display command information
-
- man [-k] name ...
-
- man accepts the following options:
-
- -k Interpret name as a keyword. The man utility searches
- a database containing a summary of the WinXs command
- line utilities for instances of name. Each resulting
- line is written to standard output.
-
- If -k is not specified, man writes information about each of
- the utilities identified by the name operands. This
- information is written to standard output, which can be
- redirected if required.
-
- #name mv
- #whatis mv - move files
-
- mv [-fiRr] source_file target_file
- mv [-fiRr] source_file ... directory
-
- mv accepts the following options:
-
- -f Overwrite the target file if it already exists,
- without prompting for confirmation. Any previous
- occurrences of -i are ignored.
-
- -i Prompt for confirmation before overwriting an existing
- file. Any previous occurrences of -f are ignored. If
- neither -f or -i is specified on the command line, -i
- is assumed.
-
- -R Does nothing. This option is included for consistency
- with the cp utility.
-
- -r Same as -R.
-
- In the first form, mv simply moves source_file to
- target_file. This form is assumed when the final operand is
- a file, or when target_file does not identify an existing
- filestore object.
-
- In the second form, mv moves each file named by source_file
- to the target directory, which must exist; that is, the
- target directory will not be created by the mv utility. In
- this form, source_file can identify either a file or a
- directory. In the case of a directory, the entire directory
- structure rooted at source_file will be moved.
-
- In addition to moving the data of a file, mv also duplicates
- the mode of the file and its current access/modification
- times.
-
- #name nl
- #whatis nl - line numbering filter
-
- nl [-b type] [-v startnum] [-i incr] [-s sep] [-w width] [-n
- format] [file ...]
-
- nl accepts the following options:
-
- -b Specifies which lines should be numbered, where type
- can be one of a (number all lines), t (number non-
- blank lines only), n (no line numbering), or pString.
- In the latter case, String is a regular expression;
- only matching lines are numbered. The default type is
- t.
-
- -v The initial value used to number lines (default 1).
-
- -i The line number increment value (default 1).
-
- -s The character or characters used to separate the line
- number from the text line. The default is a single
- tab character.
-
- -w The width of a line number in columns (default 6).
-
- -n The line numbering format, where format can be one of
- ln (left justified), rn (right justified), or rz
- (right justified with leading zeros).
-
- nl writes its output to standard output, and reads its input
- from standard input if no file is specified.
-
- #name od
- #whatis od - dump files in various formats
-
- od [-v] [-A addr_base] [-j skip] [-N count] [-t type_string]
- [file...]
-
- od accepts the following options:
-
- -A addr_base
- Specifies the input base. The addr_base option is a
- single character, which can be one of 'd' (decimal),
- 'o' (octal) or 'x' (hexadecimal). The default is '-A
- o'.
-
- -j skip
- Jump over 'skip' bytes from the beginning of the
- input. The od utility will jump over the first 'skip'
- bytes of the concatenated input. By default the
- 'skip' option is interpreted as a decimal number.
- With a leading 0 it is treated as an octal number;
- with a leading 0x or 0X it is treated as a hexadecimal
- number. 'skip' can be followed by the character 'b'
- indicating 512 byte blocks should be skipped, by a 'k'
- indicating kilobytes blocks, or by a 'm' indicating
- megabyte blocks.
-
- -N count
- Format no more than 'count' bytes of input. By
- default 'count' is interpreted as a decimal number.
- With a leading 0 it is interpreted as an octal number;
- with a leading 0x or 0X it is treated as a hexadecimal
- number. The characters 'b', 'k' and 'm' can be
- appended to 'count' with the effects described above.
-
- -t type_string
- Specifies one or more input types. 'type_string'
- consists of a type specification character followed by
- an optional qualifier. The valid type specification
- characters are 'a' (interpret bytes as 7-bit
- characters in the ISO/IEC 646:1991 International
- Reference Version standard), 'c' (interpret bytes as
- 8-bit characters), 'd' (decimal numbers), 'f'
- (floating point numbers), 'o' (octal numbers), 'u'
- (unsigned decimal numbers), or 'x' (hexadecimal
- numbers). The type specification characters 'd', 'f',
- 'o', 'u' and 'x' can be followed by an optional
- decimal qualifier specifying the number of bytes to be
- transformed (e.g. '-t x4' indicates 4-byte hexadecimal
- values). The type specification character 'f' can
- also be followed by the characters 'F', 'D' or 'L',
- indicating float, double and long double types
- respectively. The type specification characters 'd',
- 'o', 'u' or 'x' can be followed by the characters 'C',
- 'S', 'I' or 'L', indicating char, short, int or long
- types respectively. The default setting is '-t o2'.
-
- -v Write all input data. Without this option, groups of
- output lines that have identical content are only
- output once, followed by a line containing a single
- asterisk character (*).
-
- The od utility copies each input file to standard output,
- transforming the input data according to the output types
- specified by the options. Input is read from standard input
- if no files are given on the command line.
-
- #name paste
- #whatis paste - concatenate corresponding or subsequent lines from files
-
- paste [-s] [-d list] [file ...]
-
- paste accepts the following options:
-
- -d list
- "list" is a blank or comma separated list of elements.
- Each element in list specifies a character to use to
- replace newline characters in the input. An element
- can be an ordinary character, or one of \n (newline),
- \t (tab), \\ (backslash) or \0 (empty string). The
- list is circular; that is, when the list is exhausted,
- the first element from the list is reused. When -s is
- specified, the list is reset at the start of each new
- input file; when -s is not specified, the list is
- reset at the start of each new line. If -d is not
- specified, a tab character is used by default.
-
- -s Concatenate all the lines of each input file in
- command line order. Otherwise, concatenate successive
- lines from each of the input files (that is, the first
- line of output will contain line1 from file1, the
- first element from "list", the first line from file2,
- etc.).
-
- The paste utility concatenates the corresponding lines from
- its input files (-s not specified), or it concatenates
- successive lines from each input file (-s specified). The
- newline character of every line, except the line from the
- last input file (or the last line from each file if -s is
- specified), is replaced by the next character in the "-d
- list". If no files are specified on the command line, or if
- "-" is specified, input is read from the standard input.
- Output is always written to standard output.
-
- #name pg
- #whatis pg - display file page-by-page
-
- pg [options] [file ...]
-
- pg accepts the following options:
-
- -Num Change window size (default 24 lines).
-
- -pString Use String as the command prompt (default ":").
-
- +Num Start displaying the file at line number Num
- (default 1).
-
- +String Start displaying the file at the first line
- containing the regular expression identified by
- String.
-
- The pg utility is a filter that allows files to be displayed
- one screenful at a time. Each screen is followed by a
- prompt. If you press the carriage-return key, another page
- of the file is displayed. Other command options are
- described below.
-
- This utility is intended as an alternative to the MORE.EXE
- program delivered with all DOS systems. It provides forward
- and backward file movement commands, text searching, and can
- be used at the end of a pipeline to peruse command output.
-
- The following commands can be issued at the command prompt:
-
- PAGE_DOWN forward one screen
- PAGE_UP back one screen
- DOWN_ARROW forward one line
- UP_ARROW back one line
- RIGHT_ARROW forward one half screen
- LEFT_ARROW back one half screen
- HOME start of file
- END end of file
- h help
- q or Q quit
- [+-N]\n Nth next page
- n next file
- p previous file
- Nw or Nz set window size to N lines
- s savefile save current file in savefile
- /pattern/ search forward for pattern
- ?pattern? search backward for pattern
- !command execute command
-
- #name rm
- #whatis rm - remove files and directories
-
- rm [-fiRr] source_file ...
-
- rm accepts the following options:
-
- -f Remove source_file from the system without prompting
- for confirmation. Any previous occurrences of the -i
- option are ignored.
-
- -i Prompt for confirmation before removing source_file
- from the system. Any previous occurrences of the -f
- option are ignored. If neither -f or -i is specified
- on the command line, the -i option is assumed.
-
- -R Remove the file hierarchy identified by source_file,
- including all files and subdirectories of source_file
- and source_file itself. When this option is
- specified, source_file can identify either a file or a
- directory. Otherwise, if neither -R or -r is
- specified, source_file can only identify a file.
-
- -r Same as -R.
-
- If source_file is either "." or "..", rm will write a
- diagnostic message to the console and proceed to the next
- operand (if any). Be especially careful of the classic "rm
- -rf *" use of this utility, which will delete everything in
- the current directory, all its subdirectories, and all their
- contents. The effects of this command are irreversible.
-
- #name sdiff
- #whatis sdiff - list file differences side-by-side
-
- sdiff [-ls] [-w width] file1 file2
-
- sdiff accepts the following options:
-
- -l List all lines from file1 but only list lines from
- file2 that differ or are not present in file1.
-
- -s List differences only, introducing each set of
- differences as per the diff utility.
-
- -w width
- Set the line width to "width" characters (default 80).
-
- The sdiff utility calls "diff -b" to determine the
- differences between file1 and file2. It then processes the
- output so that file1 and file2 are listed side-by-side, with
- difference marks appearing in the margin between the two
- columns of output. A "|" character in this margin indicates
- lines that are different, a "<" indicates extra lines in
- file1, and a ">" indicates extra lines in file2. The
- default output writes all the lines from both files. Output
- is always written to standard output.
-
- #name sed
- #whatis sed - stream editor
-
- sed [-n] script [file ...]
- sed [-n] [-e script] ... [-f script-file] ... [file ...]
-
- sed accepts the following options:
-
- -n Suppress the default output.
-
- -e Add the editing command specified by script to the end
- of the script of editing commands. Use this option to
- specify multiple editing commands on the command line.
-
- -f Read one or more editing commands from script_file
- and add them to the end of the editing script.
-
- If file is not specified on the command line, sed reads its
- input from standard input. The output is always written to
- standard output.
-
- #name sort
- #whatis sort - sort or merge text files
-
- sort [-bdfimnru] [-k keydef] [-t char] [-o output] [file
- ...]
-
- sort accepts the following options:
-
- -b Ignore leading blanks when determining the starting
- and ending positions of a restricted sort key.
-
- -d Dictionary ordering.
-
- -f Fold character case.
-
- -i Ignore non-printing characters.
-
- -m Merge only. Assumes the input files are already
- sorted.
-
- -n Sort numerically.
-
- -r Reverse sort order.
-
- -u Unique. Suppress all but one in each set of lines
- that have equal sort keys.
-
- -k keydef specifies a restricted sort key.
-
- -t Use char as the field separator character.
-
- -o Write output to the file named by output, rather than
- to standard output.
-
- The command line version of sort sorts the lines of all
- named files together and writes the result to standard
- output, or output if the -o option is specified.
-
- #name split
- #whatis split - break a file into fixed size pieces
-
- split [[-l count]|[-b n[k|m]] [file [suffix]]
-
- split accepts the following options:
-
- -l Split file into one or more files each containing
- count lines.
-
- -b Split file into n byte chunks, nb 512-byte chunks, nk
- kilobyte chunks, or nm megabyte chunks.
-
- The generated files will have names beginning at
- file.suffix. If file is not specified on the command line,
- input will be taken from standard input and output files
- will be named xaa, xab, etc..
-
- #name strings
- #whatis strings - find printable strings in a file
-
- strings [-n number] [-t format] [file ...]
-
- strings accepts the following options:
-
- -n Specifies the minimum string length in bytes (default
- 4).
-
- -t Each string is written to the output preceded by its
- byte offset. The format is a single character d (the
- offset will be written in decimal), o (the offset will
- be written in octal), or x (the offset will be written
- in hexadecimal).
-
- strings writes its output to standard output, and reads its
- input from standard input if no file is specified.
-
- #name tail
- #whatis tail - display the last part of a file
-
- tail [-f][-n lines] [file ...]
-
- tail accepts the following options:
-
- -f Monitor a file as it grows. Every second, tail wakes
- up and displays any new data added to the end of the
- file. This flag is ignored if reading from a pipe.
- Use Ctrl-C to terminate the command when this flag is
- specified.
-
- -n Display lines (default 10) from the end of each input
- file.
-
- tail writes its output to standard output, and reads input
- from standard input if no file is specified.
-
- #name tee
- #whatis tee - duplicate standard input
-
- tee [-a] [file ...]
-
- tee accepts the following options:
-
- -a Append the output to files rather than overwriting
- them.
-
- The tee utility copies standard input to standard output,
- making a copy in zero or more files.
-
- #name touch
- #whatis touch - change file modification time
-
- touch [-acm] [-r ref_file | -t time] file...
-
- touch accepts the following options:
-
- -a Reserved for future use.
-
- -c Normally, touch will create file if it does not
- already exist. Specifying -c overrides this behaviour
- and file will not be created.
-
- -m Reserved for future use.
-
- -r ref_file
- Use the modification time of ref_file instead of the
- current time.
-
- -t time
- Use the specified time instead of the current time,
- where time is a decimal number of the form:
-
- [[CC]YY]MMDDhhmm[.SS].
-
- The two digit sequences represent:
-
- CC The first two digits of the year (century).
-
- YY The second two digits of the year.
-
- MM The month of the year [01-12].
-
- DD The day of the month [01-31].
-
- hh The hour of the day [00-23].
-
- mm The minute of the hour [00-59].
-
- SS The second of the minute [00-61].
-
- CC and YY are optional. If neither is given, the
- current year is assumed. If YY is specified but CC is
- not, YY values in the range [69-99] are assumed to
- refer to the 20th century (i.e., 19YY), YY values in
- the range [00-68] are assumed to refer to the 21st
- century (i.e., 20YY).
-
- Note that on only dates between Jan 1, 1980 and Jan 1,
- 2036 are supported on Windows systems. The results of
- specifying any date outside this range are
- unspecified.
-
- If neither -r or -t is specified, the modification time of
- file will be set to the current time.
-
- #name tr
- #whatis tr - translate characters
-
- tr [-c] string1 string2
- tr -d [-c] string1
- tr -s [-c] string1
-
- tr accepts the following options:
-
- -c Complement string1.
-
- -d Delete characters in string1.
-
- -s Squeeze characters in string1.
-
- If neither -d nor -s is specified, tr will replace all input
- characters identified in String1 with the corresponding
- character in String2. The input is always read from
- standard input, and the output is always written to standard
- output.
-
- #name uncompress
- #whatis uncompress - restore a compressed file to its original state
-
- compress -d [-c] [file ...]
-
- compress accepts the following options:
-
- -c cat output. Normally the named files are uncompressed
- in place. If this option is specified, the output is
- written to standard output instead.
-
- If file is not specified, the input is read from standard
- input and the output is written to standard output.
-
- #name uniq
- #whatis uniq - report or filter out repeated lines in a file
-
- uniq [-c|-d|-u] [-f fields] [-s char] [infile [outfile]]
-
- uniq accepts the following options:
-
- -c Precede each output line with a count of the number of
- times the line occurred in the input.
-
- -d Suppress the writing of lines that are not repeated in
- the input.
-
- -f field
- Begin the comparison of adjacent lines in the input
- starting at the specified field number (default 1). A
- field is regarded as a maximal string of non-blank
- characaters, where a blank character is defined as
- <tab> or <space>. If this option specifies more
- fields than are present in an input line, a null
- string is used for comparison.
-
- -s chars
- Ignore the first "chars" characters when doing
- comparisons. If -f is also specified, ignore the
- first "chars" characters after the first "fields"
- fields.
-
- -u Suppress the writing of lines that are repeated in the
- input.
-
- The uniq utility reads an input file comparing adjacent
- lines, and writes one copy of each line to the output. If
- infile is not specified, standard input is read; output is
- written to outfile, or standard output if outfile is not
- specified.
-
- #name unix2dos
- #whatis unix2dos - convert UNIX to DOS text file format
-
- unix2dos [-o output] file ...
-
- unix2dos accepts the following options:
-
- -o Normally unix2dos converts files in place. If this
- option is specified, and output names a file, all the
- input is converted and appended to the named file; if
- it names a directory, the input files are copied to
- the named directory and then converted. If file names
- a directory, this option must be specified and output
- must also identify a directory.
-
- #name uudecode
- #whatis uudecode - decode a binary file
-
- uudecode [input-file]
-
- If input-file is not specified, uudecode will read its input
- from standard input. Output is always written to standard
- output.
-
- #name uuencode
- #whatis uuencode - encode a binary file
-
- uuencode [input-file] unix-name
-
- If input-file is not specified, uuencode will read its input
- from standard input. Output is always written to standard
- output.
-
- #name wc
- #whatis wc - count words, lines and bytes in a file
-
- wc [-lw] [-c | -m] [file ...]
-
- wc accepts the following options:
-
- -l Count lines
-
- -w Count words
-
- -c Count bytes
-
- -m Count characters
-
- If no options are specified, lines, words and bytes are
- counted by default. The output is written to standard
- output. Input is taken from standard input if file is not
- specified.
-
- #name whence
- #whatis whence - interpret command name
-
- whence [-v] name ...
-
- whence accepts the following options:
-
- -v List all possible paths to 'name'.
-
- The whence command accepts one or more command names and
- shows how these names will be interpreted by the command
- interpreter. That is, it lists the full pathname of each
- input command, complete with its extension. If the '-v'
- option is specified, whence lists all instances of 'name'.
- For example, the command:
-
- > whence -v find
-
- might produce the output:
-
- find is C:\WINXS32\BIN\find.exe
- find is C:\WINDOWS\COMMAND\find.exe
-
- indicating that the command will be executed from
- "C:\WINXS32\BIN\find.exe", and also that there is another
- find command located in "C:\WINDOWS\COMMAND\find.exe". This
- second command is effectively hidden unless the full
- pathname is specified.
-
- To change the above order of commands, you can modify the
- PATH variable to change the directory search order.
-
- #name xargs
- #whatis xargs - construct argument lists and execute a command
-
- xargs [-ipqtx] [-I replstr] [-n number] [-s size]
- [utility [args ...]]
-
- xargs accepts the following options:
-
- -I replstr
- Insert mode. "utility" will be executed for each line
- of input, replacing "replstr" in "args" with the
- contents of the input line.
-
- -i Equivalent to "-I {}"
-
- -n number
- Limit the number of arguments in each invocation of
- utility to "number".
-
- -p Prompt mode. Prompt for confirmation before each
- invocation of utility.
-
- -q Quote mode. When insert mode is specified, quote each
- instance of "replstr" in args after substitution. You
- should use this option if the input contains file
- names that may contain spaces.
-
- -s size
- Limit the command length to "size" bytes.
-
- -t Enable trace mode. Each generated command will be
- displayed prior to invocation.
-
- -x Terminate the command if a generated command line
- containing "number" arguments will not fit into "size"
- bytes.
-
- The xargs utility contructs a command line consisting of
- "utility", followed by "args", followed by as many arguments
- read from standard input as will fit into the specified
- "number" and "size" constraints. The constructed command is
- then executed. By default, "size" is limited to 512 bytes;
- "number" is unlimited.
-
- Alternatively, if insert mode is set (-I or -i specified),
- utility is invoked for each line read from standard input,
- taking the entire input line as a single argument. Each
- instance of "replstr" in "args" is replaced by the contents
- of the input line.
-
- If "utility" is not specified on the command line, "echo" is
- set by default.
-
-