| 1 | .\" Copyright (c) 1980 Regents of the University of California. |
| 2 | .\" All rights reserved. The Berkeley software License Agreement |
| 3 | .\" specifies the terms and conditions for redistribution. |
| 4 | .\" |
| 5 | .\" @(#)dd.1 6.1 (Berkeley) %G% |
| 6 | .\" |
| 7 | .TH DD 1 "" |
| 8 | .UC 4 |
| 9 | .SH NAME |
| 10 | dd \- convert and copy a file |
| 11 | .SH SYNOPSIS |
| 12 | .B dd |
| 13 | [option=value] ... |
| 14 | .SH DESCRIPTION |
| 15 | .I Dd |
| 16 | copies the specified input file |
| 17 | to the specified output with |
| 18 | possible conversions. |
| 19 | The standard input and output are used by default. |
| 20 | The input and output block size may be |
| 21 | specified to take advantage of raw physical I/O. |
| 22 | .PP |
| 23 | .br |
| 24 | .ns |
| 25 | .TP 15 |
| 26 | .I option |
| 27 | .I values |
| 28 | .br |
| 29 | .ns |
| 30 | .TP |
| 31 | if= |
| 32 | input file name; standard input is default |
| 33 | .br |
| 34 | .ns |
| 35 | .TP |
| 36 | of= |
| 37 | output file name; standard output is default |
| 38 | .br |
| 39 | .ns |
| 40 | .TP |
| 41 | .RI ibs= n |
| 42 | input block size |
| 43 | .I n |
| 44 | bytes (default 512) |
| 45 | .br |
| 46 | .ns |
| 47 | .TP |
| 48 | .RI obs= n |
| 49 | output block size (default 512) |
| 50 | .br |
| 51 | .ns |
| 52 | .TP |
| 53 | .RI bs= n |
| 54 | set both input and output block size, |
| 55 | superseding |
| 56 | .I ibs |
| 57 | and |
| 58 | .I obs; |
| 59 | also, if no conversion is specified, |
| 60 | it is particularly efficient since no copy need be done |
| 61 | .br |
| 62 | .ns |
| 63 | .TP |
| 64 | .RI cbs= n |
| 65 | conversion buffer size |
| 66 | .br |
| 67 | .ns |
| 68 | .TP |
| 69 | .RI skip= n |
| 70 | skip |
| 71 | .IR n "" |
| 72 | input records before starting copy |
| 73 | .br |
| 74 | .ns |
| 75 | .TP |
| 76 | .RI files= n |
| 77 | copy |
| 78 | .I n |
| 79 | input files before terminating (makes sense only |
| 80 | where input is a magtape or similar device). |
| 81 | .br |
| 82 | .ns |
| 83 | .TP |
| 84 | .RI seek= n |
| 85 | seek |
| 86 | .I n |
| 87 | records from beginning of output file before copying |
| 88 | .br |
| 89 | .ns |
| 90 | .TP |
| 91 | count=\fIn\fR |
| 92 | copy only |
| 93 | .IR n "" |
| 94 | input records |
| 95 | .br |
| 96 | .ns |
| 97 | .TP |
| 98 | conv=ascii |
| 99 | .ds h \h'\w'conv='u' |
| 100 | convert EBCDIC to ASCII |
| 101 | .br |
| 102 | .ns |
| 103 | .IP \*hebcdic |
| 104 | convert ASCII to EBCDIC |
| 105 | .br |
| 106 | .ns |
| 107 | .IP \*hibm |
| 108 | slightly different map of ASCII to EBCDIC |
| 109 | .br |
| 110 | .ns |
| 111 | .IP \*hblock |
| 112 | convert variable length records to fixed length |
| 113 | .br |
| 114 | .ns |
| 115 | .IP \*hunblock |
| 116 | convert fixed length records to variable length |
| 117 | .br |
| 118 | .ns |
| 119 | .IP \*hlcase |
| 120 | map alphabetics to lower case |
| 121 | .br |
| 122 | .ns |
| 123 | .IP \*hucase |
| 124 | map alphabetics to upper case |
| 125 | .br |
| 126 | .ns |
| 127 | .IP \*hswab |
| 128 | swap every pair of bytes |
| 129 | .br |
| 130 | .ns |
| 131 | .IP \*hnoerror |
| 132 | do not stop processing on an error |
| 133 | .br |
| 134 | .ns |
| 135 | .IP \*hsync |
| 136 | pad every input record to |
| 137 | .I ibs |
| 138 | .br |
| 139 | .ns |
| 140 | .IP "\*h... , ..." |
| 141 | several comma-separated conversions |
| 142 | .PP |
| 143 | .fi |
| 144 | Where sizes are specified, |
| 145 | a number of bytes is expected. |
| 146 | A number may end with |
| 147 | .B "k, b" |
| 148 | or |
| 149 | .B w |
| 150 | to specify multiplication by |
| 151 | 1024, 512, or 2 respectively; |
| 152 | a pair of numbers may be separated by |
| 153 | .B x |
| 154 | to indicate a product. |
| 155 | .PP |
| 156 | .I Cbs |
| 157 | is used only if |
| 158 | .I ascii, |
| 159 | .I unblock, |
| 160 | .I ebcdic, |
| 161 | .I ibm, |
| 162 | or |
| 163 | .I block |
| 164 | conversion is specified. |
| 165 | In the first two cases, |
| 166 | .I cbs |
| 167 | characters are placed into the conversion buffer, any specified |
| 168 | character mapping is done, |
| 169 | trailing blanks trimmed and new-line added |
| 170 | before sending the line to the output. |
| 171 | In the latter three cases, characters are read into the |
| 172 | conversion buffer, and blanks added |
| 173 | to make up an |
| 174 | output record of size |
| 175 | .IR cbs . |
| 176 | .PP |
| 177 | After completion, |
| 178 | .I dd |
| 179 | reports the number of whole and partial input and output |
| 180 | blocks. |
| 181 | .PP |
| 182 | For example, to read an EBCDIC tape blocked ten 80-byte |
| 183 | EBCDIC card images per record into the ASCII file |
| 184 | .I x: |
| 185 | .IP |
| 186 | .nf |
| 187 | dd if=/dev/rmt0 of=x ibs=800 cbs=80 conv=ascii,lcase |
| 188 | .fi |
| 189 | .PP |
| 190 | Note the use of raw magtape. |
| 191 | .I Dd |
| 192 | is especially suited to I/O on the raw |
| 193 | physical devices because it allows reading |
| 194 | and writing in arbitrary record sizes. |
| 195 | .SH "SEE ALSO" |
| 196 | cp(1), tr(1) |
| 197 | .SH DIAGNOSTICS |
| 198 | f+p records in(out): numbers of full and partial records read(written) |
| 199 | .SH BUGS |
| 200 | The ASCII/EBCDIC conversion tables are |
| 201 | taken |
| 202 | from the 256 character standard in |
| 203 | the CACM Nov, 1968. |
| 204 | The `ibm' conversion, while less blessed as a standard, |
| 205 | corresponds better to certain IBM print train conventions. |
| 206 | There is no universal solution. |
| 207 | .br |
| 208 | One must specify ``conv=noerror,sync'' when copying |
| 209 | raw disks with bad sectors to insure |
| 210 | .I dd |
| 211 | stays synchronized. |
| 212 | .PP |
| 213 | Certain combinations of arguments to |
| 214 | .I conv= |
| 215 | are permitted. |
| 216 | However, the |
| 217 | .I block |
| 218 | or |
| 219 | .I unblock |
| 220 | option cannot be combined with |
| 221 | .IR ascii , |
| 222 | .IR ebcdic "" |
| 223 | or |
| 224 | .IR ibm . |
| 225 | Invalid combinations |
| 226 | .I "silently ignore" |
| 227 | all but the last mutually-exclusive keyword. |