DD(1)                                                       DD(1)



NAME

       dd - convert and copy a file


SYNOPSIS

       dd  [--help]  [--version]  [if=file] [of=file] [ibs=bytes]
       [obs=bytes]    [bs=bytes]    [cbs=bytes]     [skip=blocks]
       [seek=blocks]  [count=blocks]  [conv={ascii,  ebcdic, ibm,
       block, unblock,  lcase,  ucase,  swab,  noerror,  notrunc,
       sync}]


DESCRIPTION

       dd  copies a file (from standard input to standard output,
       by default) using specific input  and  output  blocksizes,
       while optionally performing conversions on it.

       It  reads  the input one block at a time, using the speci-
       fied input block size (the default is 512 bytes).  If  the
       bs=bytes  option  was  given, and no conversion other than
       sync, noerror, or notrunc was  specified,  it  writes  the
       amount  of data read (which could be smaller than what was
       requested) in a separate output block. This  output  block
       has  precisely the same length as was read unless the sync
       conversion was specified, in which case the data is padded
       with NULs (or spaces, see below).

       Otherwise,  the  input,  read one block at a time, is pro-
       cessed and the resulting output is collected  and  written
       in  blocks  of  the specified output block size. The final
       output block may be shorter.

       The numeric-valued options below (bytes and blocks) can be
       followed  by a multiplier: `k'=1024, `b'=512, `w'=2, `c'=1
       (`w' and `c' are GNU extensions; `w' should never be  used
       - it means 2 in System V and 4 in 4.2BSD).  Two or more of
       such numeric expressions can be multiplied by putting  `x'
       in between.  The GNU fileutils-4.0 version also allows the
       following multiplicative suffixes in the specification  of
       blocksizes   (in   bs=,   cbs=,  ibs=,  obs=):  M=1048576,
       G=1073741824, and so on for T, P, E, Z, Y.  A  `D'  suffix
       makes  them  decimal:  kD=1000, MD=1000000, GD=1000000000,
       etc.  (Note that for ls, df, du the  size  of  M  etc.  is
       determined  by  environment  variables,  but  for dd it is
       fixed.)


OPTIONS

       if=file
              Read from file instead of standard input.

       of=file
              Write to file instead of standard  output.   Unless
              conv=notrunc  is  given,  dd truncates file to zero
              bytes (or the size specified with seek=).





GNU fileutils 4.0         November 1998                         1





DD(1)                                                       DD(1)


       ibs=bytes
              Read bytes bytes at a time. The default is 512.

       obs=bytes
              Write bytes bytes at a time. The default is 512.

       bs=bytes
              Both read and write bytes bytes at  a  time.   This
              overrides  ibs  and  obs.   (And  setting bs is not
              equivalent with setting both ibs and  obs  to  this
              same  value, at least when no conversion other than
              sync, noerror and notrunc is  specified,  since  it
              stipulates that each input block shall be copied to
              the output as a single  block  without  aggregating
              short blocks.)

       cbs=bytes
              Specify  the  conversion  block  size for block and
              unblock.

       skip=blocks
              Skip blocks  ibs-byte  blocks  in  the  input  file
              before copying.

       seek=blocks
              Skip  blocks  obs-byte  blocks  in  the output file
              before copying.

       count=blocks
              Copy blocks ibs-byte blocks from  the  input  file,
              instead of everything until the end of the file.

       conv=CONVERSION[,CONVERSION]...
              Convert  the  file  as  specified by the CONVERSION
              argument(s).  (No spaces around any comma(s).)

              Conversions:


              ascii  Convert EBCDIC to ASCII.

              ebcdic Convert ASCII to EBCDIC.

              ibm    Convert ASCII to alternate EBCDIC.

              block  For each  line  in  the  input,  output  cbs
                     bytes,  replacing  the  input newline with a
                     space and padding with spaces as  necessary.

              unblock
                     Replace  trailing  spaces  in each cbs-sized
                     input block with a newline.

              lcase  Change uppercase letters to lowercase.



GNU fileutils 4.0         November 1998                         2





DD(1)                                                       DD(1)


              ucase  Change lowercase letters to uppercase.

              swab   Swap every pair of input bytes.  If  an  odd
                     number  of  bytes  are read the last byte is
                     simply copied (since  there  is  nothing  to
                     swap  it with).  [POSIX 1003.2b, PASC inter-
                     pretations 1003.2 #3 and #4]

              noerror
                     Continue after read errors.

              notrunc
                     Do not truncate the output file.

              sync   Pad every input block to size  of  ibs  with
                     trailing zero bytes.


GNU STANDARD OPTIONS

       --help Print  a  usage message on standard output and exit
              successfully.

       --version
              Print version information on standard output,  then
              exit successfully.

       --     Terminate option list.


ENVIRONMENT

       The  variables LANG, LC_ALL, LC_CTYPE and LC_MESSAGES have
       the usual meaning.


CONFORMING TO

       POSIX 1003.2


EXAMPLE

       Often a tape  drive  will  not  accept  arbitrarily  sized
       blocks,  and  dd would get an I/O error for the last frag-
       ment of data that does not fill an entire block.  Use  `dd
       if=myfile  of=/dev/mytape  conv=sync' to get everything on
       tape. Of course,  reading  it  back  will  now  produce  a
       slightly larger file, with nulls added at the end.


BUGS

       Commands  like  `dd  if=myfile of=/dev/fd0 bs=1k seek=172'
       fail on some systems because dd tries to truncate the out-
       put  file,  but truncation of a block device is not possi-
       ble. In such cases, add the `conv=notrunc' option.


NOTES

       This page describes dd as found in the fileutils-4.0 pack-
       age; other versions may differ slightly.  Mail corrections
       and additions to aeb@cwi.nl.  Report bugs in  the  program
       to fileutils-bugs@gnu.ai.mit.edu.




GNU fileutils 4.0         November 1998                         3