[Previous] [Contents] [Next]

dd

Convert a file while copying it (UNIX)

Syntax:

dd [if=input_file] [of=output_file] [options]

Options:


Note:

All numbers can be followed by a multiplier:

b
blocks (*512)
k
kbytes (*1024)
w
words (*2)
xm
multiply by m

if=input_file
Read from input_file instead of the standard input.
of=output_file
Write to output_file instead of the standard output. Unless conv=notrunc is given, truncate the file to the size specified by seek= (0 bytes if seek= is not given).
ibs=bytes
Read bytes bytes at a time.
obs=bytes
Write bytes bytes at a time.
bs=bytes
Read and write bytes bytes at a time. Override ibs and obs.
cbs=bytes
Convert bytes bytes at a time.
skip=blocks
Skip blocks ibs-sized blocks at start of input.
seek=blocks
Skip blocks obs-sized blocks at start of output.
count=blocks
Copy only blocks ibs-sized input blocks.
conv=conversion[,conversion...]
Convert the file as specified by the conversion arguments. Conversions are:
ascii
Convert EBCDIC to ASCII.
ebcdic
Convert ASCII to EBCDIC.
ibm
Convert ASCII to alternate EBCDIC.
block
Pad newline-terminated records to size of cbs, replacing newline with trailing spaces.
unblock
Replace trailing spaces in cbs-sized block with newline.
lcase
Change uppercase characters to lowercase.
ucase
Change lowercase characters to uppercase.
swab
Swap every pair of input bytes. Unlike the Unix dd, this works when an odd number of bytes are read. If the input file contains an odd number of bytes, 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 NULs.

Description:

This manual page documents the GNU version of dd. The dd utility copies a file (from the standard input to the standard output, by default) with a user-selectable blocksize, while optionally performing conversions on it. It is meant for writing raw data directly to devices such as tape and disk or writing over the network, with control over blocking factors and character set translations.

This command may be used for copying partial files. The block size, skip count, and number of blocks to copy can be specified. Where sizes are expected, they are in bytes. However, the letters w, b, or k may be appended to the number to indicate words (2 bytes), blocks (512 bytes), or K (1024 bytes), respectively. When dd is finished, it reports the number of full and partial blocks read and written.

Examples:

Copy file file1 to file2, converting all text to lowercase letters:

    dd if=file1 of=file2 conv=lcase

Exit status:

>0
An error occurred.
0
The copy/translate operation was successful.

Contributing author:

GNU

See also:

cat, cp, pax, tr, head


[Previous] [Contents] [Next]