dd(1M)
NAME
dd − convert and copy a file
SYNOPSIS
dd [ option=value ] ...
DESCRIPTION
dd copies the specified input file to the specified output with possible conversions. The standard input and output are used by default. The input and output block sizes may be specified to take advantage of raw physical I/O.
Where sizes are specified, a number of bytes is expected. A number may end with k, b, or w to specify multiplication by 1024, 512, or 2, respectively; a pair of numbers may be separated by x to indicate multiplication.
cbs is used only if ascii, unblock, ebcdic, ibm, or block conversion is specified. In the first two cases, cbs characters are copied into the conversion buffer, any specified character mapping is done, trailing blanks are trimmed and a new-line is added before sending the line to the output. In the latter three cases, characters are read into the conversion buffer and blanks are added to make up an output record of size cbs. If cbs is unspecified or zero, the ascii, ebcdic, and ibm options convert the character set without changing the block structure of the input file; the unblock and block options become a simple file copy.
After completion, dd reports the number of whole and partial input and output blocks.
OPTIONS
if=file Input file name; standard input is default.
of=file Output file name; standard output is default.
ibs=n Input block size n bytes (default 512).
obs=n Output block size n bytes (default 512).
bs=n Set both input and output block size, superseding ibs and obs; also, if no conversion is specified, preserve the input block size instead of packing short blocks into the output buffer (this is particularly efficient since no in-core copy need be done).
cbs=n Conversion buffer size (logical record length).
files=n Copy and concatenate n input files before terminating (makes sense only where input is a magnetic tape or similar device).
skip=n Skip n input blocks before starting copy (appropriate for magnetic tape, where iseek is undefined).
iseek=n Seek n blocks from beginning of input file before copying (appropriate for disk files, where skip can be incredibly slow).
oseek=n Seek n blocks from beginning of output file before copying.
seek=n Identical to oseek, retained for backward compatibility.
count=n Copy only n input blocks.
conv=ascii Convert EBCDIC to ASCII.
ebcdic Convert ASCII to EBCDIC.
ibm Slightly different map of ASCII to EBCDIC.
block Convert new-line terminated ASCII records to fixed length.
unblock Convert fixed length ASCII records to new-line terminated records.
lcase Map alphabetics to lower case.
ucase Map alphabetics to upper case.
swab Swap every pair of bytes.
noerror Do not stop processing on an error (limit of 5 consecutive errors).
sync Pad every input block to ibs.
... , ... several comma-separated conversions
EXAMPLE
This command will read an EBCDIC tape blocked ten 80-byte EBCDIC card images per tape block into the ASCII file x:
dd if=/dev/rmt/0h of=x ibs=800 obs=8k cbs=80 conv=ascii,lcase
Note the use of raw magnetic tape. dd is especially suited to I/O on the raw physical devices because it allows reading and writing in arbitrary block sizes.
ENVIRONMENT
If any of the LC_∗ variables ( LC_CTYPE, LC_MESSAGES, LC_TIME, LC_COLLATE, LC_NUMERIC, and LC_MONETARY ) (see environ(5)) are not set in the environment, the operational behavior of dd for each corresponding locale category is determined by the value of the LANG environment variable. If LC_ALL is set, its contents are used to override both the LANG and the other LC_∗ variables. If none of the above variables are set in the environment, the "C" (U.S. style) locale determines how dd behaves.
LC_CTYPE
Determines how dd handles characters. When LC_CTYPE is set to a valid value, dd can display and handle text and filenames containing valid characters for that locale. dd can display and handle Extended Unix Code (EUC) characters where any individual character can be one, two, or three bytes wide. dd can also handle EUC characters of one, two, or more column widths. In the "C" locale, only characters from ISO 8859-1 are valid.
LC_MESSAGES
Determines how diagnostic and informative messages are presented. This includes the language and style of the messages, and the correct form of affirmative and negative responses. In the "C" locale, the messages are presented in the default form found in the program itself (in most cases, U.S. English).
SEE ALSO
DIAGNOSTICS
f+p records in(out)numbers of full and partial blocks read(written)
NOTES
Do not use dd to copy files between filesystems having different block sizes.
Using a blocked device to copy a file will result in extra nulls being added to the file to pad the final block to the block boundary.
When dd reads from a pipe, using the ibs=X and obs=Y operands, the output will always be blocked in chunks of size Y. When bs=Z is used, the output blocks will be whatever was available to be read from the pipe at the time.
SunOS 5.1 — Last change: 5 Jul 1990