DD

Section: User Commands (1)
Updated: August 1998
 

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 specified 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 processed 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.  

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=).
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.
ucase
Change lowercase letters to uppercase.
swab
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).
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

SEE ALSO

cp
slice
binedit

NOTES

This page describes dd as found in the fileutils-3.16 package; other versions may differ slightly. Mail corrections and additions to aeb@cwi.nl and aw@mail1.bet1.puv.fi and ragnar@lightside.ddns.org . Report bugs in the program to fileutils-bugs@gnu.ai.mit.edu.

.\" Copyright Andries Brouwer, Ragnar Hojland Espinosa and A. Wik, 1998.
.\"
.\" This file may be copied under the conditions described
.\" in the LDP GENERAL PUBLIC LICENSE, Version 1, September 1998
.\" that should have been distributed together with this file.