[BACK]Return to dd.1 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / bin / dd

Annotation of src/bin/dd/dd.1, Revision 1.10

1.10    ! kleink      1: .\"    $NetBSD: dd.1,v 1.9 2000/08/28 02:11:05 hubertf Exp $
1.5       cgd         2: .\"
1.3       mycroft     3: .\" Copyright (c) 1990, 1993
                      4: .\"    The Regents of the University of California.  All rights reserved.
1.1       glass       5: .\"
                      6: .\" This code is derived from software contributed to Berkeley by
                      7: .\" Keith Muller of the University of California, San Diego.
                      8: .\"
                      9: .\" Redistribution and use in source and binary forms, with or without
                     10: .\" modification, are permitted provided that the following conditions
                     11: .\" are met:
                     12: .\" 1. Redistributions of source code must retain the above copyright
                     13: .\"    notice, this list of conditions and the following disclaimer.
                     14: .\" 2. Redistributions in binary form must reproduce the above copyright
                     15: .\"    notice, this list of conditions and the following disclaimer in the
                     16: .\"    documentation and/or other materials provided with the distribution.
                     17: .\" 3. All advertising materials mentioning features or use of this software
                     18: .\"    must display the following acknowledgement:
                     19: .\"    This product includes software developed by the University of
                     20: .\"    California, Berkeley and its contributors.
                     21: .\" 4. Neither the name of the University nor the names of its contributors
                     22: .\"    may be used to endorse or promote products derived from this software
                     23: .\"    without specific prior written permission.
                     24: .\"
                     25: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     26: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     27: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     28: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     29: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     30: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     31: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     32: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     33: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     34: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     35: .\" SUCH DAMAGE.
                     36: .\"
1.5       cgd        37: .\"    @(#)dd.1        8.2 (Berkeley) 1/13/94
1.1       glass      38: .\"
1.8       hubertf    39: .Dd July 28, 1999
1.1       glass      40: .Dt DD 1
                     41: .Os
                     42: .Sh NAME
                     43: .Nm dd
1.3       mycroft    44: .Nd convert and copy a file
1.1       glass      45: .Sh SYNOPSIS
1.6       enami      46: .Nm
1.1       glass      47: .Op operands ...
                     48: .Sh DESCRIPTION
                     49: The
                     50: .Nm
                     51: utility copies the standard input to the standard output.
                     52: Input data is read and written in 512-byte blocks.
                     53: If input reads are short, input from multiple reads are aggregated
                     54: to form the output block.
                     55: When finished,
1.6       enami      56: .Nm
1.1       glass      57: displays the number of complete and partial input and output blocks
                     58: and truncated input records to the standard error output.
                     59: .Pp
                     60: The following operands are available:
                     61: .Bl -tag -width of=file
                     62: .It Cm bs= Ns Ar n
                     63: Set both input and output block size, superseding the
                     64: .Cm ibs
                     65: and
                     66: .Cm obs
                     67: operands.
                     68: If no conversion values other than
                     69: .Cm noerror ,
                     70: .Cm notrunc
                     71: or
                     72: .Cm sync
                     73: are specified, then each input block is copied to the output as a
                     74: single block without any aggregation of short blocks.
                     75: .It Cm cbs= Ns Ar n
                     76: Set the conversion record size to
                     77: .Va n
                     78: bytes.
                     79: The conversion record size is required by the record oriented conversion
                     80: values.
                     81: .It Cm count= Ns Ar n
                     82: Copy only
                     83: .Va n
                     84: input blocks.
                     85: .It Cm files= Ns Ar n
                     86: Copy
                     87: .Va n
                     88: input files before terminating.
                     89: This operand is only applicable when the input device is a tape.
                     90: .It Cm ibs= Ns Ar n
                     91: Set the input block size to
                     92: .Va n
                     93: bytes instead of the default 512.
                     94: .It Cm if= Ns Ar file
                     95: Read input from
                     96: .Ar file
                     97: instead of the standard input.
                     98: .It Cm obs= Ns Ar n
                     99: Set the output block size to
                    100: .Va n
                    101: bytes instead of the default 512.
                    102: .It Cm of= Ns Ar file
                    103: Write output to
                    104: .Ar file
                    105: instead of the standard output.
                    106: Any regular output file is truncated unless the
                    107: .Cm notrunc
                    108: conversion value is specified.
                    109: If an initial portion of the output file is skipped (see the
                    110: .Cm seek
                    111: operand)
                    112: the output file is truncated at that point.
                    113: .It Cm seek= Ns Ar n
                    114: Seek
                    115: .Va n
                    116: blocks from the beginning of the output before copying.
                    117: On non-tape devices, a
                    118: .Xr lseek 2
                    119: operation is used.
                    120: Otherwise, existing blocks are read and the data discarded.
                    121: If the user does not have read permission for the tape, it is positioned
                    122: using the tape
                    123: .Xr ioctl 2
                    124: function calls.
                    125: If the seek operation is past the end of file, space from the current
                    126: end of file to the specified offset is filled with blocks of
                    127: .Tn NUL
                    128: bytes.
                    129: .It Cm skip= Ns Ar n
                    130: Skip
                    131: .Va n
                    132: blocks from the beginning of the input before copying.
                    133: On input which supports seeks, a
                    134: .Xr lseek 2
                    135: operation is used.
                    136: Otherwise, input data is read and discarded.
                    137: For pipes, the correct number of bytes is read.
                    138: For all other devices, the correct number of blocks is read without
                    139: distinguishing between a partial or complete block being read.
1.8       hubertf   140: .It Cm progress= Ns Ar n
                    141: Switch on display of progress if
                    142: .Va n
                    143: is set to ``1'', i.e. a ``.'' is printed for each
                    144: block written to the output file.
1.1       glass     145: .It Xo
                    146: .Cm conv=
                    147: .Ns Cm value Ns Op \&, Cm value \&...
                    148: .Xc
                    149: Where
                    150: .Cm value
                    151: is one of the symbols from the following list.
                    152: .Bl -tag -width unblock
                    153: .It Cm ascii , oldascii
                    154: The same as the
                    155: .Cm unblock
                    156: value except that characters are translated from
1.4       hpeyerl   157: .Tn EBCDIC
1.1       glass     158: to
                    159: .Tn ASCII
                    160: before the
                    161: records are converted.
                    162: (These values imply
                    163: .Cm unblock
                    164: if the operand
                    165: .Cm cbs
                    166: is also specified.)
                    167: There are two conversion maps for
                    168: .Tn ASCII .
                    169: The value
                    170: .Cm ascii
1.7       perry     171: specifies the recommended one which is compatible with
                    172: .At V .
1.1       glass     173: The value
                    174: .Cm oldascii
                    175: specifies the one used in historic
                    176: .Tn AT&T
1.7       perry     177: and pre-
                    178: .Bx 4.3 Reno
                    179: systems.
1.1       glass     180: .It Cm block
                    181: Treats the input as a sequence of newline or end-of-file terminated variable
                    182: length records independent of input and output block boundaries.
                    183: Any trailing newline character is discarded.
                    184: Each input record is converted to a fixed length output record where the
                    185: length is specified by the
                    186: .Cm cbs
                    187: operand.
                    188: Input records shorter than the conversion record size are padded with spaces.
                    189: Input records longer than the conversion record size are truncated.
                    190: The number of truncated input records, if any, are reported to the standard
1.3       mycroft   191: error output at the completion of the copy.
1.1       glass     192: .It Cm ebcdic , ibm , oldebcdic , oldibm
                    193: The same as the
                    194: .Cm block
                    195: value except that characters are translated from
                    196: .Tn ASCII
                    197: to
                    198: .Tn EBCDIC
                    199: after the
                    200: records are converted.
                    201: (These values imply
                    202: .Cm block
                    203: if the operand
                    204: .Cm cbs
                    205: is also specified.)
                    206: There are four conversion maps for
                    207: .Tn EBCDIC .
                    208: The value
                    209: .Cm ebcdic
                    210: specifies the recommended one which is compatible with
                    211: .At V .
                    212: The value
                    213: .Cm ibm
                    214: is a slightly different mapping, which is compatible with the
                    215: .At V
                    216: .Cm ibm
                    217: value.
                    218: The values
                    219: .Cm oldebcdic
                    220: and
                    221: .Cm oldibm
                    222: are maps used in historic
                    223: .Tn AT&T
1.7       perry     224: and pre
                    225: .Bx 4.3 Reno
                    226: systems.
1.1       glass     227: .It Cm lcase
                    228: Transform uppercase characters into lowercase characters.
                    229: .It Cm noerror
                    230: Do not stop processing on an input error.
                    231: When an input error occurs, a diagnostic message followed by the current
1.3       mycroft   232: input and output block counts will be written to the standard error output
                    233: in the same format as the standard completion message.
1.1       glass     234: If the
                    235: .Cm sync
                    236: conversion is also specified, any missing input data will be replaced
                    237: with
                    238: .Tn NUL
                    239: bytes (or with spaces if a block oriented conversion value was
                    240: specified) and processed as a normal input buffer.
                    241: If the
                    242: .Cm sync
                    243: conversion is not specified, the input block is omitted from the output.
                    244: On input files which are not tapes or pipes, the file offset
                    245: will be positioned past the block in which the error occurred using
                    246: .Xr lseek 2 .
                    247: .It Cm notrunc
                    248: Do not truncate the output file.
                    249: This will preserve any blocks in the output file not explicitly written
                    250: by
1.6       enami     251: .Nm "" .
1.1       glass     252: The
                    253: .Cm notrunc
                    254: value is not supported for tapes.
1.3       mycroft   255: .It Cm osync
                    256: Pad the final output block to the full output block size.
                    257: If the input file is not a multiple of the output block size
                    258: after conversion, this conversion forces the final output block
                    259: to be the same size as preceding blocks for use on devices that require
                    260: regularly sized blocks to be written.
                    261: This option is incompatible with use of the
                    262: .Cm bs= Ns Ar n
                    263: block size specification.
1.1       glass     264: .It Cm swab
                    265: Swap every pair of input bytes.
                    266: If an input buffer has an odd number of bytes, the last byte will be
                    267: ignored during swapping.
                    268: .It Cm sync
                    269: Pad every input block to the input buffer size.
                    270: Spaces are used for pad bytes if a block oriented conversion value is
                    271: specified, otherwise
                    272: .Tn NUL
                    273: bytes are used.
                    274: .It Cm ucase
                    275: Transform lowercase characters into uppercase characters.
                    276: .It Cm unblock
                    277: Treats the input as a sequence of fixed length records independent of input
                    278: and output block boundaries.
                    279: The length of the input records is specified by the
                    280: .Cm cbs
                    281: operand.
                    282: Any trailing space characters are discarded and a newline character is
                    283: appended.
                    284: .El
                    285: .El
                    286: .Pp
                    287: Where sizes are specified, a decimal number of bytes is expected.
                    288: If the number ends with a ``b'', ``k'', ``m'' or ``w'', the number
                    289: is multiplied by 512, 1024 (1K), 1048576 (1M) or the number of bytes
                    290: in an integer, respectively.
                    291: Two or more numbers may be separated by an ``x'' to indicate a product.
                    292: .Pp
                    293: When finished,
1.6       enami     294: .Nm
1.1       glass     295: displays the number of complete and partial input and output blocks,
                    296: truncated input records and odd-length byte-swapping blocks to the
                    297: standard error output.
                    298: A partial input block is one where less than the input block size
                    299: was read.
                    300: A partial output block is one where less than the output block size
                    301: was written.
                    302: Partial output blocks to tape devices are considered fatal errors.
                    303: Otherwise, the rest of the block will be written.
                    304: Partial output blocks to character devices will produce a warning message.
                    305: A truncated input block is one where a variable length record oriented
                    306: conversion value was specified and the input line was too long to
                    307: fit in the conversion record or was not newline terminated.
                    308: .Pp
                    309: Normally, data resulting from input or conversion or both are aggregated
                    310: into output blocks of the specified size.
                    311: After the end of input is reached, any remaining output is written as
                    312: a block.
                    313: This means that the final output block may be shorter than the output
                    314: block size.
                    315: .Pp
                    316: If
1.6       enami     317: .Nm
1.1       glass     318: receives a
                    319: .Dv SIGINFO
                    320: (see the ``status'' argument for
                    321: .Xr stty 1 )
                    322: signal, the current input and output block counts will
1.3       mycroft   323: be written to the standard error output
                    324: in the same format as the standard completion message.
1.1       glass     325: If
1.6       enami     326: .Nm
1.1       glass     327: receives a
                    328: .Dv SIGINT
                    329: signal, the current input and output block counts will
1.3       mycroft   330: be written to the standard error output
                    331: in the same format as the standard completion message and
1.6       enami     332: .Nm
1.1       glass     333: will exit.
                    334: .Pp
1.10    ! kleink    335: .Sh EXIT STATUS
1.1       glass     336: The
1.6       enami     337: .Nm
1.1       glass     338: utility exits 0 on success and >0 if an error occurred.
                    339: .Sh SEE ALSO
                    340: .Xr cp 1 ,
                    341: .Xr mt 1 ,
                    342: .Xr tr 1
                    343: .Sh STANDARDS
                    344: The
1.6       enami     345: .Nm
1.1       glass     346: utility is expected to be a superset of the
                    347: .St -p1003.2
                    348: standard.
                    349: The
                    350: .Cm files
                    351: operand and the
                    352: .Cm ascii ,
                    353: .Cm ebcdic ,
                    354: .Cm ibm ,
                    355: .Cm oldascii ,
                    356: .Cm oldebcdic
                    357: and
                    358: .Cm oldibm
                    359: values are extensions to the
                    360: .Tn POSIX
                    361: standard.

CVSweb <webmaster@jp.NetBSD.org>