www.delorie.com/gnu/docs/textutils/coreutils_65.html   search  
Buy GNU books!

GNU Core-utils

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.2 dd: Convert and copy a file

dd copies a file (from standard input to standard output, by default) with a changeable I/O block size, while optionally performing conversions on it. Synopsis:

dd [option]...

The program accepts the following options. Also see 2. Common options.

The numeric-valued options below (bytes and blocks) can be followed by a multiplier: `b'=512, `c'=1, `w'=2, `xm'=m, or any of the standard block size suffixes like `k'=1024 (see section 2.2 Block size).

Use different dd invocations to use different block sizes for skipping and I/O. For example, the following shell commands copy data in 512 KiB blocks between a disk and a tape, but do not save or restore a 4 KiB label at the start of the disk:


# Copy all but the label from disk to tape.
(dd bs=4k skip=1 count=0 && dd bs=512k) <$disk >$tape

# Copy from tape back to disk, but leave the disk label alone.
(dd bs=4k seek=1 count=0 && dd bs=512k) <$tape >$disk

Read from file instead of standard input.

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

Read bytes bytes at a time.

Write bytes bytes at a time.

Both read and write bytes bytes at a time. This overrides `ibs' and `obs'.

Convert bytes bytes at a time.

Skip blocks `ibs'-byte blocks in the input file before copying.

Skip blocks `obs'-byte blocks in the output file before copying.

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

Convert the file as specified by the conversion argument(s). (No spaces around any comma(s).)


Convert EBCDIC to ASCII.

Convert ASCII to EBCDIC.

Convert ASCII to alternate EBCDIC.

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

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

Change uppercase letters to lowercase.

Change lowercase letters to uppercase.

Swap every pair of input bytes. GNU dd, unlike others, works when an odd number of bytes are read--the last byte is simply copied (since there is nothing to swap it with).

Continue after read errors.

Do not truncate the output file.

Pad every input block to size of `ibs' with trailing zero bytes. When used with `block' or `unblock', pad with spaces instead of zero bytes.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003