Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dd(1) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cp, copy

tr

iconv

ebcdic

tape



DD(1,C)                     AIX Commands Reference                      DD(1,C)



-------------------------------------------------------------------------------
dd



PURPOSE

Converts and copies a file.

SYNTAX


                             +- ibs=512 -+   +- obs=512 -+
      +----------------+   +-|           |---|           |-+
dd ---| +------------+ |---| +- ibs=num -+   +- obs=num -+ |--->
      +-|1           |-+   +----------- bs=num ------------+
       ^| if=infile  ||
       || of=outfile ||
       || cbs=num    ||
       || fskip=num  ||
       || skip=num   ||
       || seek=num   ||
       || count=num  ||
       |+------------+|
       +--------------+

    +------------------------------+
>---|        6+------------------+ |---|
    +- conv= -| ascii 2  unblock |-+
             ^| ebcdic   lcase 3 ||
             || iblock   ucase   ||
             || ibm      swab    ||
             || oblock   noerror ||
             || block    sync    ||
             || tonls    fromnls ||
             || ibm      flatten ||
             |+------------------+|
             |          6         |
             +-------- , ---------+

----------------
1 infile and outfile default to standard input and standard output.
2 Use only one of ascii and ebcdic.
3 Use only one of lcase and ucase.
6 Do not use blanks around equal sign and commas.


DESCRIPTION

Note:  If you are using a system that supports a multibyte character set, use
       the iconv command (see page iconv-1) to convert data encoded in one
       file code into another file code.



Processed November 8, 1990          DD(1,C)                                   1





DD(1,C)                     AIX Commands Reference                      DD(1,C)




The dd command reads the specified infile or standard input, does the specified
conversions, and copies it to the specified outfile or standard output.  The
input and output block size may be specified to take advantage of raw physical
I/O.  The terms block and record refer to the quantity of data read or written
by dd in one operation and are not necessarily the same size as a disk block.

Where sizes are specified, a number of bytes is expected.  A number may end
with w, b, or k to specify multiplication by 2, 512, or 1024 respectively; a
pair of numbers can be separated by an x to indicate a product.

The conversion requested by conv=fromnls translates each extended character in
a text file to a printable ASCII escape sequence that uniquely identifies the
extended character.  The complementary conversion, provided by conv=tonls,
translates ASCII escape sequences to the corresponding extended character.  The
conversion requested by conv=flatten translates an extended character to the
single ASCII character most resembling it in appearance or to a "?" (question
mark) if no ASCII characters resemble that extended character.

The character set mappings associated with conv=ASCII and conv=ebcdic are
complementary operations, described in the ebcdic file in AIX Operating System
Technical Reference.  These attempt to map between ASCII and the subset of
EBCDIC that is found on most terminals and keypunches.

The cbs specification is used if one of the following conversions is specified:
ASCII, unblock, ebcdic, ibm, or block.  For the first two conversions, dd
places characters in a conversion buffer of size cbs, converts these characters
to ASCII, trims trailing blanks and adds new-line characters before sending
data specified output.  For the latter three cases, dd places ASCII characters
in the conversion buffer, converts these characters to EBCDIC, adds trailing
blanks to create records of size cbs.

After it finishes, dd reports the number of whole and partial input and output
blocks.

Notes:

  1. Normally, you need only write access to the output file.  However, when
    the output file is not on a direct access device and you use the seek
    parameter, you also need read access to the file.

  2. The dd command inserts new-line characters only when converting to ASCII;
    it pads only when converting to EBCDIC.

  3. Use the backup, tar, or cpio commands instead of the dd command whenever
    possible to copy files to tape.  These commands are designed for use with
    tape devices.

  4. If you need to use dd to copy to a streaming tape and the data is an odd
    length (not a multiple of 512 bytes), you must use the conv=sync option to
    fill the last record.  Streaming tape devices permit only multiples of 512
    bytes.



Processed November 8, 1990          DD(1,C)                                   2





DD(1,C)                     AIX Commands Reference                      DD(1,C)




  5. When using dd to copy to tape, consult the hardware documentation for that
    tape drive to determind block size.

  6. Compared to disk drives, tape drives generally require a smaller block
    size.

PARAMETERS

if=infile   Specifies the input file name; standard input is the default.

of=outfile  Specifies the output file name; standard output is the default.

ibs=num     Specifies the input block size in bytes; the default is 512.

obs=num     Specifies the output block size in bytes; the default is 512.

bs=num      Specifies both the input and output block size, superseding ibs and
            obs.

cbs=num     Specifies the conversion buffer size.

skip=num    Skip num input records before starting copy.

seek=num    Seek to the numth record from the beginning of output file before
            copying.

fskip=num   Skip past num end-of-file characters before starting copy; this
            parameter is useful for positioning on multi-file magnetic tapes.

count=num   Copies only num input blocks.  The default block size is 512 bytes
            (see the ibs parameter).

conv=spec[,spec...]
            Specifies one or more of the following conversions:

            ascii       Converts EBCDIC to ASCII.
            ebcdic      Converts ASCII to EBCDIC.
            ibm         Slightly different map of ASCII to EBCDIC
            block       Convert variable length records to fixed length
            unblock     Convert fixed length records to variable length
            tonls       Converts ASCII escape sequences to extended characters.
            fromnls     Converts extended characters to ASCII escape sequences.
            flatten     Converts extended characters to the ASCII character
                        most resembling it or to a "?" (question mark).

            And one or more of the following conversions:

            iblock      Minimizes data loss resulting from a read or write
            oblock      error on direct access devices.  If you specify iblock
                        and an error occurs during a block read (where the
                        block size is 512 or the size specified by ibs=num), dd
                        attempts to reread the data block in smaller size
                        units.  If dd can determine the sector size of the

Processed November 8, 1990          DD(1,C)                                   3





DD(1,C)                     AIX Commands Reference                      DD(1,C)



                        input device, it reads the bad record one sector at a
                        time.  Otherwise, it reads it 512 bytes at a time.  The
                        input block size (ibs) must be a multiple of this
                        "retry size".  This allows you to maximize disk input
                        efficiency while ensuring that data loss associated
                        with a read error is confined to a single sector.  The
                        oblock conversion works similarly on output.

            lcase       Makes all alphabetic characters lowercase.
            ucase       Makes all alphabetic characters uppercase.
            swab        Swaps every pair of bytes.
            noerror     Does not stop processing on an error.
            sync        Pads every input record to ibs.
            ... , ...   Several comma-separated conversions.

EXAMPLE

  1. To convert an ASCII text file to EBCDIC:

      dd if=text.ascii of=text.ebcdic conv=ebcdic

    This converts "text.ASCII" to EBCDIC representation, storing the EBCDIC
    version in "text.ebcdic".

    Note:  When you specify "conv=ebcdic", dd converts the ASCII ^ (circumflex)
           character to an unused EBCDIC character (9A hexadecimal), and ASCII
           ~ (tilde) to EBCDIC ^ (NOT symbol).

  2. To use dd as a filter:

      li -l | dd conv=ucase

    This displays a long listing of the current directory ("li -l") in
    uppercase.

  3. To copy an XA370 file system on the first partition to a 3480 cartridge
    tape with a maximum block size:

      dd if=/dev/chd00033 of=/dev/rmt0rh bs=65535

RELATED INFORMATION

See the following commands:  "cp, copy," "tr" and "iconv."

See the ebcdic and tape files in AIX Operating System Technical Reference.










Processed November 8, 1990          DD(1,C)                                   4



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026