]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - bin/dd/dd.1
Added man page usb uhci ohci
[FreeBSD/FreeBSD.git] / bin / dd / dd.1
1 .\" Copyright (c) 1990, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to Berkeley by
5 .\" Keith Muller of the University of California, San Diego.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\" 3. All advertising materials mentioning features or use of this software
16 .\"    must display the following acknowledgement:
17 .\"     This product includes software developed by the University of
18 .\"     California, Berkeley and its contributors.
19 .\" 4. Neither the name of the University nor the names of its contributors
20 .\"    may be used to endorse or promote products derived from this software
21 .\"    without specific prior written permission.
22 .\"
23 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" SUCH DAMAGE.
34 .\"
35 .\"     @(#)dd.1        8.2 (Berkeley) 1/13/94
36 .\"     $Id: dd.1,v 1.7 1998/05/06 06:51:35 charnier Exp $
37 .\"
38 .Dd January 13, 1994
39 .Dt DD 1
40 .Os
41 .Sh NAME
42 .Nm dd
43 .Nd convert and copy a file
44 .Sh SYNOPSIS
45 .Nm dd
46 .Op operands ...
47 .Sh DESCRIPTION
48 The
49 .Nm
50 utility copies the standard input to the standard output.
51 Input data is read and written in 512-byte blocks.
52 If input reads are short, input from multiple reads are aggregated
53 to form the output block.
54 When finished,
55 .Nm
56 displays the number of complete and partial input and output blocks
57 and truncated input records to the standard error output.
58 .Pp
59 The following operands are available:
60 .Bl -tag -width of=file
61 .It Cm bs= Ns Ar n
62 Set both input and output block size to
63 .Va n
64 bytes, superseding the
65 .Cm ibs
66 and
67 .Cm obs
68 operands.
69 If no conversion values other than
70 .Cm noerror ,
71 .Cm notrunc
72 or
73 .Cm sync
74 are specified, then each input block is copied to the output as a
75 single block without any aggregation of short blocks.
76 .It Cm cbs= Ns Ar n
77 Set the conversion record size to
78 .Va n
79 bytes.
80 The conversion record size is required by the record oriented conversion
81 values.
82 .It Cm count= Ns Ar n
83 Copy only
84 .Va n
85 input blocks.
86 .It Cm files= Ns Ar n
87 Copy
88 .Va n
89 input files before terminating.
90 This operand is only applicable when the input device is a tape.
91 .It Cm ibs= Ns Ar n
92 Set the input block size to
93 .Va n
94 bytes instead of the default 512.
95 .It Cm if= Ns Ar file
96 Read input from
97 .Ar file
98 instead of the standard input.
99 .It Cm obs= Ns Ar n
100 Set the output block size to
101 .Va n
102 bytes instead of the default 512.
103 .It Cm of= Ns Ar file
104 Write output to
105 .Ar file
106 instead of the standard output.
107 Any regular output file is truncated unless the
108 .Cm notrunc
109 conversion value is specified.
110 If an initial portion of the output file is skipped (see the
111 .Cm seek
112 operand),
113 the output file is truncated at that point.
114 .It Cm seek= Ns Ar n
115 Seek
116 .Va n
117 blocks from the beginning of the output before copying.
118 On non-tape devices, an
119 .Xr lseek 2
120 operation is used.
121 Otherwise, existing blocks are read and the data discarded.
122 If the user does not have read permission for the tape, it is positioned
123 using the tape
124 .Xr ioctl 2
125 function calls.
126 If the seek operation is past the end of file, space from the current
127 end of file to the specified offset is filled with blocks of
128 .Tn NUL
129 bytes.
130 .It Cm skip= Ns Ar n
131 Skip
132 .Va n
133 blocks from the beginning of the input before copying.
134 On input which supports seeks, an
135 .Xr lseek 2
136 operation is used.
137 Otherwise, input data is read and discarded.
138 For pipes, the correct number of bytes is read.
139 For all other devices, the correct number of blocks is read without
140 distinguishing between a partial or complete block being read.
141 .It Xo
142 .Cm conv=
143 .Ns Cm value Ns Op \&, Cm value \&...
144 .Xc
145 Where
146 .Cm value
147 is one of the symbols from the following list.
148 .Bl -tag -width unblock
149 .It Cm ascii , oldascii
150 The same as the
151 .Cm unblock
152 value except that characters are translated from
153 .Tn EBCDIC
154 to
155 .Tn ASCII
156 before the
157 records are converted.
158 (These values imply
159 .Cm unblock
160 if the operand
161 .Cm cbs
162 is also specified.)
163 There are two conversion maps for
164 .Tn ASCII .
165 The value
166 .Cm ascii
167 specifies the recommended one which is compatible with System V.
168 The value
169 .Cm oldascii
170 specifies the one used in historic
171 .Tn AT&T
172 and pre-4.3BSD-reno systems.
173 .It Cm block
174 Treats the input as a sequence of newline or end-of-file terminated variable
175 length records independent of input and output block boundaries.
176 Any trailing newline character is discarded.
177 Each input record is converted to a fixed length output record where the
178 length is specified by the
179 .Cm cbs
180 operand.
181 Input records shorter than the conversion record size are padded with spaces.
182 Input records longer than the conversion record size are truncated.
183 The number of truncated input records, if any, are reported to the standard
184 error output at the completion of the copy.
185 .It Cm ebcdic , ibm , oldebcdic , oldibm
186 The same as the
187 .Cm block
188 value except that characters are translated from
189 .Tn ASCII
190 to
191 .Tn EBCDIC
192 after the
193 records are converted.
194 (These values imply
195 .Cm block
196 if the operand
197 .Cm cbs
198 is also specified.)
199 There are four conversion maps for
200 .Tn EBCDIC .
201 The value
202 .Cm ebcdic
203 specifies the recommended one which is compatible with
204 .At V .
205 The value
206 .Cm ibm
207 is a slightly different mapping, which is compatible with the
208 .At V
209 .Cm ibm
210 value.
211 The values
212 .Cm oldebcdic
213 and
214 .Cm oldibm
215 are maps used in historic
216 .Tn AT&T
217 and pre-4.3BSD-reno systems.
218 .It Cm lcase
219 Transform uppercase characters into lowercase characters.
220 .It Cm noerror
221 Do not stop processing on an input error.
222 When an input error occurs, a diagnostic message followed by the current
223 input and output block counts will be written to the standard error output
224 in the same format as the standard completion message.
225 If the
226 .Cm sync
227 conversion is also specified, any missing input data will be replaced
228 with
229 .Tn NUL
230 bytes (or with spaces if a block oriented conversion value was
231 specified) and processed as a normal input buffer.
232 If the
233 .Cm sync
234 conversion is not specified, the input block is omitted from the output.
235 On input files which are not tapes or pipes, the file offset
236 will be positioned past the block in which the error occurred using
237 .Xr lseek 2 .
238 .It Cm notrunc
239 Do not truncate the output file.
240 This will preserve any blocks in the output file not explicitly written
241 by
242 .Nm Ns .
243 The
244 .Cm notrunc
245 value is not supported for tapes.
246 .It Cm osync
247 Pad the final output block to the full output block size.
248 If the input file is not a multiple of the output block size
249 after conversion, this conversion forces the final output block
250 to be the same size as preceding blocks for use on devices that require
251 regularly sized blocks to be written.
252 This option is incompatible with use of the
253 .Cm bs= Ns Ar n
254 block size specification.
255 .It Cm sparse
256 If one or more output blocks would consist solely of
257 .Tn NUL
258 bytes, try to seek the output file by the required space instead of
259 filling them with
260 .Tn NULs ,
261 resulting in a sparse file.
262 .It Cm swab
263 Swap every pair of input bytes.
264 If an input buffer has an odd number of bytes, the last byte will be
265 ignored during swapping.
266 .It Cm sync
267 Pad every input block to the input buffer size.
268 Spaces are used for pad bytes if a block oriented conversion value is
269 specified, otherwise
270 .Tn NUL
271 bytes are used.
272 .It Cm ucase
273 Transform lowercase characters into uppercase characters.
274 .It Cm unblock
275 Treats the input as a sequence of fixed length records independent of input
276 and output block boundaries.
277 The length of the input records is specified by the
278 .Cm cbs
279 operand.
280 Any trailing space characters are discarded and a newline character is
281 appended.
282 .El
283 .El
284 .Pp
285 Where sizes are specified, a decimal number of bytes is expected.
286 If the number ends with a ``b'', ``k'', ``m'' or ``w'', the number
287 is multiplied by 512, 1024 (1K), 1048576 (1M) or the number of bytes
288 in an integer, respectively.
289 Two or more numbers may be separated by an ``x'' to indicate a product.
290 .Pp
291 When finished,
292 .Nm
293 displays the number of complete and partial input and output blocks,
294 truncated input records and odd-length byte-swapping blocks to the
295 standard error output.
296 A partial input block is one where less than the input block size
297 was read.
298 A partial output block is one where less than the output block size
299 was written.
300 Partial output blocks to tape devices are considered fatal errors.
301 Otherwise, the rest of the block will be written.
302 Partial output blocks to character devices will produce a warning message.
303 A truncated input block is one where a variable length record oriented
304 conversion value was specified and the input line was too long to
305 fit in the conversion record or was not newline terminated.
306 .Pp
307 Normally, data resulting from input or conversion or both are aggregated
308 into output blocks of the specified size.
309 After the end of input is reached, any remaining output is written as
310 a block.
311 This means that the final output block may be shorter than the output
312 block size.
313 .Pp
314 If
315 .Nm
316 receives a
317 .Dv SIGINFO
318 (see the ``status'' argument for
319 .Xr stty 1 )
320 signal, the current input and output block counts will
321 be written to the standard error output
322 in the same format as the standard completion message.
323 If
324 .Nm
325 receives a
326 .Dv SIGINT
327 signal, the current input and output block counts will
328 be written to the standard error output
329 in the same format as the standard completion message and
330 .Nm
331 will exit.
332 .Pp
333 The
334 .Nm
335 utility exits 0 on success or >0 if an error occurred.
336 .Sh SEE ALSO
337 .Xr cp 1 ,
338 .Xr mt 1 ,
339 .Xr tr 1
340 .Sh STANDARDS
341 The
342 .Nm
343 utility is expected to be a superset of the
344 .St -p1003.2
345 standard.
346 The
347 .Cm files
348 operand and the
349 .Cm ascii ,
350 .Cm ebcdic ,
351 .Cm ibm ,
352 .Cm oldascii ,
353 .Cm oldebcdic
354 and
355 .Cm oldibm
356 values are extensions to the
357 .Tn POSIX
358 standard.