|DD(1P)||POSIX Programmer's Manual||DD(1P)|
- An input block is read.
- If the input block is shorter than the specified input block size and the sync conversion is specified, null bytes shall be appended to the input data up to the specified size. (If either block or unblock is also specified, <space> characters shall be appended instead of null bytes.) The remaining conversions and output shall include the pad characters as if they had been read from the input.
- If the bs=expr operand is specified and no conversion other than sync or noerror is requested, the resulting data shall be written to the output as a single block, and the remaining steps are omitted.
- If the swab conversion is specified, each pair of input data bytes shall be swapped. If there is an odd number of bytes in the input block, the last byte in the input record shall not be swapped.
- Any remaining conversions (block, unblock, lcase, and ucase) shall be performed. These conversions shall operate on the input data independently of the input blocking; an input or output fixed-length record may span block boundaries.
- The data resulting from input or conversion or both shall be aggregated into output blocks of the specified size. After the end of input is reached, any remaining output shall be written as a block without padding if conv=sync is not specified; thus, the final output block may be shorter than the output block size.
- Specify the input pathname; the default is standard input.
- Specify the output pathname; the default is standard output. If the seek=expr conversion is not also specified, the output file shall be truncated before the copy begins if an explicit of=file operand is specified, unless conv=notrunc is specified. If seek=expr is specified, but conv=notrunc is not, the effect of the copy shall be to preserve the blocks in the output file over which dd seeks, but no other portion of the output file shall be preserved. (If the size of the seek plus the size of the input file is less than the previous size of the output file, the output file shall be shortened by the copy. If the input file is empty and either the size of the seek is greater than the previous size of the output file or the output file did not previously exist, the size of the output file shall be set to the file offset after the seek.)
- Specify the input block size, in bytes, by expr (default is 512).
- Specify the output block size, in bytes, by expr (default is 512).
- Set both input and output block sizes to expr bytes, superseding ibs= and obs=. If no conversion other than sync, noerror, and notrunc is specified, each input block shall be copied to the output as a single block without aggregating short blocks.
- Specify the conversion block size for block and unblock in bytes by expr (default is zero). If cbs= is omitted or given a value of zero, using block or unblock produces unspecified results.
The application shall ensure that this operand is also specified if the conv= operand is specified with a value of ascii, ebcdic, or ibm. For a conv= operand with an ascii value, the input is handled as described for the unblock value, except that characters are converted to ASCII before any trailing <space> characters are deleted. For conv= operands with ebcdic or ibm values, the input is handled as described for the block value except that the characters are converted to EBCDIC or IBM EBCDIC, respectively, after any trailing <space> characters are added.
- Skip n input blocks (using the specified input block size) before starting to copy. On seekable files, the implementation shall read the blocks or seek past them; on non-seekable files, the blocks shall be read and the data shall be discarded.
- Skip n blocks (using the specified output block size) from the beginning of the output file before copying. On non-seekable files, existing blocks shall be read and space from the current end-of-file to the specified offset, if any, filled with null bytes; on seekable files, the implementation shall seek to the specified offset or read the blocks as described for non-seekable files.
- Copy only n input blocks.
- conv=value[,value ...]
- Convert EBCDIC to ASCII; see Table 4-7, ASCII to EBCDIC Conversion.
- Convert ASCII to EBCDIC; see Table 4-7, ASCII to EBCDIC Conversion.
- Convert ASCII to a different EBCDIC set; see Table 4-8, ASCII to IBM EBCDIC Conversion.
- Treat the input as a sequence of <newline>-terminated or end-of-file-terminated variable-length records independent of the input block boundaries. Each record shall be converted to a record with a fixed length specified by the conversion block size. Any <newline> shall be removed from the input line; <space> characters shall be appended to lines that are shorter than their conversion block size to fill the block. Lines that are longer than the conversion block size shall be truncated to the largest number of characters that fit into that size; the number of truncated lines shall be reported (see the STDERR section).
The block and unblock values are mutually-exclusive.
- Convert fixed-length records to variable length. Read a number of bytes equal to the conversion block size (or the number of bytes remaining in the input, if less than the conversion block size), delete all trailing <space> characters, and append a <newline>.
- Map uppercase characters specified by the LC_CTYPE keyword tolower to the corresponding lowercase character. Characters for which no mapping is specified shall not be modified by this conversion.
The lcase and ucase symbols are mutually-exclusive.
- Map lowercase characters specified by the LC_CTYPE keyword toupper to the corresponding uppercase character. Characters for which no mapping is specified shall not be modified by this conversion.
- Swap every pair of input bytes.
- Do not stop processing on an input error. When an input error occurs, a diagnostic message shall be written on standard error, followed by the current input and output block counts in the same format as used at completion (see the STDERR section). If the sync conversion is specified, the missing input shall be replaced with null bytes and processed normally; otherwise, the input block shall be omitted from the output.
- Do not truncate the output file. Preserve blocks in the output file not explicitly written by this invocation of the dd utility. (See also the preceding of=file operand.)
- Pad every input block to the size of the ibs= buffer, appending null bytes. (If either block or unblock is also specified, append <space> characters, rather than null bytes.)
- A positive decimal number
- A positive decimal number followed by k, specifying multiplication by 1024
- A positive decimal number followed by b, specifying multiplication by 512
- Two or more positive decimal numbers (with or without k or b) separated by x, specifying the product of the indicated values
- Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of POSIX.1‐2008, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.)
- If set to a non-empty string value, override the values of all the other internationalization variables.
- Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments and input files), the classification of characters as uppercase or lowercase, and the mapping of characters from one case to the other.
- Determine the location of message catalogs for the processing of LC_MESSAGES.
"%u+%u records in\n", <number of whole input blocks>, < number of partial input blocks>
"%u+%u records out\n", < number of whole output blocks>, < number of partial output blocks>
"%u truncated %s\n", <number of truncated blocks>, "record" (if < number of truncated blocks> is one) "records" (otherwise)
- The input file was copied successfully.
- An error occurred.
dd if=/dev/rmt0h of=/dev/rmt1h
dd ibs=10 skip=1
dd if=/dev/tape of=x ibs=800 cbs=80 conv=ascii,lcase
- EBCDIC 0112 ('¢') and 0152 (broken pipe) do not appear in the table.
- EBCDIC 0137 ('¬') translates to/from ASCII 0236 ('^'). In the standard table, EBCDIC 0232 (no graphic) is used.
- EBCDIC 0241 ('~') translates to/from ASCII 0176 ('~'). In the standard table, EBCDIC 0137 ('¬') is used.
- 0255 ('[') and 0275 (']') appear twice, once in the same place as for the standard table and once in place of 0112 ('¢') and 0241 ('~').
EBCDIC 0275 (']') displaced EBCDIC 0241 ('~') in cell 0345. That displaced EBCDIC 0137 ('¬') in cell 0176. That displaced EBCDIC 0232 (no graphic) in cell 0136. That replaced EBCDIC 0152 (broken pipe) in cell 0313. EBCDIC 0255 ('[') replaced EBCDIC 0112 ('¢').This translation, however, reflects historical practice that (ASCII) '~' and '¬' were often mapped to each other, as were '[' and '¢'; and ']' and (EBCDIC) '~'. The cbs operand is required if any of the ascii, ebcdic, or ibm operands are specified. For the ascii operand, the input is handled as described for the unblock operand except that characters are converted to ASCII before the trailing <space> characters are deleted. For the ebcdic and ibm operands, the input is handled as described for the block operand except that the characters are converted to EBCDIC or IBM EBCDIC after the trailing <space> characters are added. The block and unblock keywords are from historical BSD practice. The consistent use of the word record in standard error messages matches most historical practice. An earlier version of System V used block, but this has been updated in more recent releases. Early proposals only allowed two numbers separated by x to be used in a product when specifying bs=, cbs=, ibs=, and obs= sizes. This was changed to reflect the historical practice of allowing multiple numbers in the product as provided by Version 7 and all releases of System V and BSD. A change to the swab conversion is required to match historical practice and is the result of IEEE PASC Interpretations 1003.2 #03 and #04, submitted for the ISO POSIX‐2:1993 standard. A change to the handling of SIGINT is required to match historical practice and is the result of IEEE PASC Interpretation 1003.2 #06 submitted for the ISO POSIX‐2:1993 standard.
|2013||IEEE/The Open Group|