xref: /illumos-gate/usr/src/man/man8/dd.8 (revision bbf21555)
166492cf0SYuri Pankov.\"
266492cf0SYuri Pankov.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
366492cf0SYuri Pankov.\" permission to reproduce portions of its copyrighted documentation.
466492cf0SYuri Pankov.\" Original documentation from The Open Group can be obtained online at
566492cf0SYuri Pankov.\" http://www.opengroup.org/bookstore/.
666492cf0SYuri Pankov.\"
766492cf0SYuri Pankov.\" The Institute of Electrical and Electronics Engineers and The Open
866492cf0SYuri Pankov.\" Group, have given us permission to reprint portions of their
966492cf0SYuri Pankov.\" documentation.
1066492cf0SYuri Pankov.\"
1166492cf0SYuri Pankov.\" In the following statement, the phrase ``this text'' refers to portions
1266492cf0SYuri Pankov.\" of the system documentation.
1366492cf0SYuri Pankov.\"
1466492cf0SYuri Pankov.\" Portions of this text are reprinted and reproduced in electronic form
1566492cf0SYuri Pankov.\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
1666492cf0SYuri Pankov.\" Standard for Information Technology -- Portable Operating System
1766492cf0SYuri Pankov.\" Interface (POSIX), The Open Group Base Specifications Issue 6,
1866492cf0SYuri Pankov.\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
1966492cf0SYuri Pankov.\" Engineers, Inc and The Open Group.  In the event of any discrepancy
2066492cf0SYuri Pankov.\" between these versions and the original IEEE and The Open Group
2166492cf0SYuri Pankov.\" Standard, the original IEEE and The Open Group Standard is the referee
2266492cf0SYuri Pankov.\" document.  The original Standard can be obtained online at
2366492cf0SYuri Pankov.\" http://www.opengroup.org/unix/online.html.
2466492cf0SYuri Pankov.\"
2566492cf0SYuri Pankov.\" This notice shall appear on any product containing this material.
2666492cf0SYuri Pankov.\"
2766492cf0SYuri Pankov.\" The contents of this file are subject to the terms of the
2866492cf0SYuri Pankov.\" Common Development and Distribution License (the "License").
2966492cf0SYuri Pankov.\" You may not use this file except in compliance with the License.
3066492cf0SYuri Pankov.\"
3166492cf0SYuri Pankov.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
3266492cf0SYuri Pankov.\" or http://www.opensolaris.org/os/licensing.
3366492cf0SYuri Pankov.\" See the License for the specific language governing permissions
3466492cf0SYuri Pankov.\" and limitations under the License.
3566492cf0SYuri Pankov.\"
3666492cf0SYuri Pankov.\" When distributing Covered Code, include this CDDL HEADER in each
3766492cf0SYuri Pankov.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
3866492cf0SYuri Pankov.\" If applicable, add the following below this CDDL HEADER, with the
3966492cf0SYuri Pankov.\" fields enclosed by brackets "[]" replaced with your own identifying
4066492cf0SYuri Pankov.\" information: Portions Copyright [yyyy] [name of copyright owner]
4166492cf0SYuri Pankov.\"
4266492cf0SYuri Pankov.\"
43c10c16deSRichard Lowe.\" Copyright 1989 AT&T
4466492cf0SYuri Pankov.\" Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
45c10c16deSRichard Lowe.\" Portions Copyright (c) 1995, Sun Microsystems, Inc.  All Rights Reserved
4666492cf0SYuri Pankov.\" Copyright (c) 2014, Joyent, Inc.  All rights Reserved.
4766492cf0SYuri Pankov.\" Copyright (c) 2014 by Delphix. All rights reserved.
48c53c97f7SRobert Mustacchi.\" Copyright 2021 Oxide Computer Company
4966492cf0SYuri Pankov.\"
50c53c97f7SRobert Mustacchi.Dd October 24, 2021
51*bbf21555SRichard Lowe.Dt DD 8
52c232df92SToomas Soome.Os
53c232df92SToomas Soome.Sh NAME
54c232df92SToomas Soome.Nm dd
55c232df92SToomas Soome.Nd convert and copy a file
56c232df92SToomas Soome.Sh SYNOPSIS
57c232df92SToomas Soome.Nm
58c232df92SToomas Soome.Op Ar operand Ns = Ns Ar value
59c232df92SToomas Soome.Ar ...
60c232df92SToomas Soome.Sh DESCRIPTION
61c232df92SToomas SoomeThe
62c232df92SToomas Soome.Nm
63c232df92SToomas Soomeutility copies the specified input file to the specified output
64c232df92SToomas Soomewith possible conversions.
65c232df92SToomas SoomeThe standard input and output are used by default.
66c10c16deSRichard LoweThe input and output block sizes may be specified to take advantage of raw
67c232df92SToomas Soomephysical I/O.
68c232df92SToomas SoomeSizes are specified in bytes; a number may end with
69c232df92SToomas Soome.Sy k ,
70c232df92SToomas Soome.Sy b ,
71c232df92SToomas Soomeor
72c232df92SToomas Soome.Sy w
73c232df92SToomas Soometo specify multiplication by 1024, 512, or 2, respectively.
74c232df92SToomas SoomeNumbers may also be separated by
75c232df92SToomas Soome.Sy x
76c232df92SToomas Soometo indicate multiplication.
77c232df92SToomas Soome.Pp
78c232df92SToomas SoomeThe
79c232df92SToomas Soome.Nm
80c232df92SToomas Soomeutility reads the input one block at a time, using the specified
81c232df92SToomas Soomeinput block size.
82c232df92SToomas Soome.Nm
83c232df92SToomas Soomethen processes the block of data actually returned,
84c232df92SToomas Soomewhich could be smaller than the requested block size unless the input flag
85c232df92SToomas Soome.Ar fullblock
86c232df92SToomas Soomeis used.
87c232df92SToomas Soome.Nm
88c232df92SToomas Soomeapplies any conversions that have been specified and writes the resulting data
89c232df92SToomas Soometo the output in blocks of the specified output block size.
90c232df92SToomas Soome.Pp
91c232df92SToomas Soome.Cm cbs
92c232df92SToomas Soomeis used only if
93c232df92SToomas Soome.Cm ascii ,
94c232df92SToomas Soome.Cm asciib ,
95c232df92SToomas Soome.Cm unblock ,
96c232df92SToomas Soome.Cm ebcdic ,
97c232df92SToomas Soome.Cm ebcdicb ,
98c232df92SToomas Soome.Cm ibm ,
99c232df92SToomas Soome.Cm ibmb ,
100c232df92SToomas Soomeor
101c232df92SToomas Soome.Cm block
102c232df92SToomas Soomeconversion is specified.
103c232df92SToomas SoomeIn the first two cases,
104c232df92SToomas Soome.Cm cbs
105c232df92SToomas Soomecharacters are copied into the conversion buffer, any specified character
106c232df92SToomas Soomemapping is done, trailing blanks are trimmed, and a
107c232df92SToomas Soome.Cm NEWLINE
108c232df92SToomas Soomeis added before sending the line to output.
109c232df92SToomas SoomeIn the last three cases, characters up to
110c232df92SToomas Soome.Cm NEWLINE
111c232df92SToomas Soomeare read into the conversion buffer and blanks are added to make up an output
112c232df92SToomas Soomerecord of size
113c232df92SToomas Soome.Cm cbs .
114c232df92SToomas Soome.Cm ASCII
115c232df92SToomas Soomefiles are presumed to contain
116c232df92SToomas Soome.Cm NEWLINE
117c232df92SToomas Soomecharacters.
118c232df92SToomas SoomeIf
119c232df92SToomas Soome.Cm cbs
120c232df92SToomas Soomeis unspecified or
121c232df92SToomas Soome.Cm 0 ,
122c232df92SToomas Soomethe
123c232df92SToomas Soome.Cm ascii ,
124c232df92SToomas Soome.Cm asciib ,
125c232df92SToomas Soome.Cm ebcdic ,
126c232df92SToomas Soome.Cm ebcdicb ,
127c232df92SToomas Soome.Cm ibm ,
128c232df92SToomas Soomeand
129c232df92SToomas Soome.Cm ibmb
130c232df92SToomas Soomeoptions convert the character set without changing the input file's block
131c232df92SToomas Soomestructure.
132c232df92SToomas SoomeThe
133c232df92SToomas Soome.Cm unblock
134c232df92SToomas Soomeand
135c232df92SToomas Soome.Cm block
136c232df92SToomas Soomeoptions become a simple file copy.
137c232df92SToomas Soome.Pp
138c232df92SToomas SoomeAfter completion,
139c232df92SToomas Soome.Nm
140c232df92SToomas Soomereports the number of whole and partial input and output blocks.
141c232df92SToomas Soome.Sh OPERANDS
142c10c16deSRichard LoweThe following operands are supported:
143c232df92SToomas Soome.Bl -tag -width "if=file"
144c232df92SToomas Soome.It Cm if= Ns Ar file
145c232df92SToomas Soome.Pp
146c232df92SToomas SoomeSpecifies the input path.
147c232df92SToomas SoomeStandard input is the default.
148c232df92SToomas Soome.It Cm of= Ns Ar file
149c232df92SToomas Soome.Pp
150c232df92SToomas SoomeSpecifies the output path.
151c232df92SToomas SoomeStandard output is the default.
152c232df92SToomas SoomeIf the
153c232df92SToomas Soome.Cm seek Ns = Ns Ar expr
154c232df92SToomas Soomeconversion is not also specified, the output file will be truncated before
155c232df92SToomas Soomethe copy begins, unless
156c232df92SToomas Soome.Cm conv Ns = Ns Ar notrunc
157c232df92SToomas Soomeis specified.
158c232df92SToomas SoomeIf
159c232df92SToomas Soome.Cm seek Ns = Ns Ar expr
160c232df92SToomas Soomeis specified, but
161c232df92SToomas Soome.Cm conv Ns = Ns Ar notrunc
162c232df92SToomas Soomeis not, the effect of the copy will be to preserve the blocks in the output
163c232df92SToomas Soomefile over which
164c232df92SToomas Soome.Nm
165c232df92SToomas Soomeseeks, but no other portion of the output file will be preserved.
166c232df92SToomas Soome(If the size of the seek plus the size of the input file is less than the
167c232df92SToomas Soomeprevious size of the output file, the output file is shortened by the copy.)
168c232df92SToomas Soome.It Cm ibs Ns = Ns Ar n
169c232df92SToomas Soome.Pp
170c232df92SToomas SoomeSpecifies the input block size in
171c232df92SToomas Soome.Ar n
172c232df92SToomas Soomebytes (default is 512).
173c232df92SToomas Soome.It Cm obs Ns = Ns Ar n
174c232df92SToomas Soome.Pp
175c232df92SToomas SoomeSpecifies the output block size in
176c232df92SToomas Soome.Ar n
177c232df92SToomas Soomebytes (default is 512).
178c232df92SToomas Soome.It Cm bs Ns = Ns Ar n
179c232df92SToomas Soome.Pp
180c232df92SToomas SoomeSets both input and output block sizes to
181c232df92SToomas Soome.Ar n
182c232df92SToomas Soomebytes, superseding
183c232df92SToomas Soome.Cm ibs Ns =
184c232df92SToomas Soomeand
185c232df92SToomas Soome.Cm obs Ns = .
186c232df92SToomas SoomeIf no conversion other than
187c232df92SToomas Soome.Cm sync ,
188c232df92SToomas Soome.Cm noerror ,
189c232df92SToomas Soomeand
190c232df92SToomas Soome.Cm notrunc
191c232df92SToomas Soomeis specified, each input block is copied to the output as a
192c10c16deSRichard Lowesingle block without aggregating short blocks.
193c232df92SToomas Soome.It Cm cbs Ns = Ns Ar n
194c232df92SToomas Soome.Pp
195c232df92SToomas SoomeSpecifies the conversion block size for
196c232df92SToomas Soome.Cm block
197c232df92SToomas Soomeand
198c232df92SToomas Soome.Cm unblock
199c232df92SToomas Soomein bytes by
200c232df92SToomas Soome.Ar n
201c232df92SToomas Soome(default is
202c232df92SToomas Soome.Cm 0 Ns ).
203c232df92SToomas SoomeIf
204c232df92SToomas Soome.Cm cbs Ns =
205c232df92SToomas Soomeis omitted or given a value of
206c232df92SToomas Soome.Cm 0 ,
207c232df92SToomas Soomeusing
208c232df92SToomas Soome.Cm block
209c232df92SToomas Soomeor
210c232df92SToomas Soome.Cm unblock
211c232df92SToomas Soomeproduces unspecified results.
212c232df92SToomas Soome.Pp
213c232df92SToomas SoomeThis option is used only if
214c232df92SToomas Soome.Cm ASCII
215c232df92SToomas Soomeor
216c232df92SToomas Soome.Cm EBCDIC
217c232df92SToomas Soomeconversion is specified.
218c232df92SToomas SoomeFor the
219c232df92SToomas Soome.Cm ascii
220c232df92SToomas Soomeand
221c232df92SToomas Soome.Cm asciib
222c232df92SToomas Soomeoperands, the input is handled as described for the
223c232df92SToomas Soome.Cm unblock
224c232df92SToomas Soomeoperand except that characters are converted to
225c232df92SToomas Soome.Cm ASCII
226c232df92SToomas Soomebefore the trailing
227c232df92SToomas Soome.Cm SPACE
228c232df92SToomas Soomecharacters are deleted.
229c232df92SToomas SoomeFor the
230c232df92SToomas Soome.Cm ebcdic ,
231c232df92SToomas Soome.Cm ebcdicb ,
232c232df92SToomas Soome.Cm ibm ,
233c232df92SToomas Soomeand
234c232df92SToomas Soome.Cm ibmb
235c232df92SToomas Soomeoperands, the input is handled as described for the
236c232df92SToomas Soome.Cm block
237c232df92SToomas Soomeoperand except that the characters are converted to
238c232df92SToomas Soome.Cm EBCDIC
239c232df92SToomas Soomeor IBM
240c232df92SToomas Soome.Cm EBCDIC
241c232df92SToomas Soomeafter the trailing
242c232df92SToomas Soome.Cm SPACE
243c10c16deSRichard Lowecharacters are added.
244c232df92SToomas Soome.It Cm files Ns = Ns Ar n
245c232df92SToomas Soome.Pp
246c232df92SToomas SoomeCopies and concatenates
247c232df92SToomas Soome.Ar n
248c232df92SToomas Soomeinput files before terminating (makes sense
249c10c16deSRichard Loweonly where input is a magnetic tape or similar device).
250c232df92SToomas Soome.It Cm skip Ns = Ns Ar n
251c232df92SToomas Soome.Pp
252c232df92SToomas SoomeSkips
253c232df92SToomas Soome.Ar n
254c232df92SToomas Soomeinput blocks (using the specified input block size) before starting to copy.
255c232df92SToomas SoomeOn seekable files, the implementation reads the blocks or seeks past them.
256c232df92SToomas SoomeOn non-seekable files, the blocks are read and the data is discarded.
257c232df92SToomas Soome.It Cm iseek Ns = Ns Ar n
258c232df92SToomas Soome.Pp
259c232df92SToomas SoomeSeeks
260c232df92SToomas Soome.Ar n
261c232df92SToomas Soomeblocks from beginning of input file before copying (appropriate
262c232df92SToomas Soomefor disk files, where
263c232df92SToomas Soome.Cm skip
264c232df92SToomas Soomecan be incredibly slow).
265c232df92SToomas Soome.It Cm oseek Ns = Ns Ar n
266c232df92SToomas Soome.Pp
267c232df92SToomas SoomeSeeks
268c232df92SToomas Soome.Ar n
269c232df92SToomas Soomeblocks from beginning of output file before copying.
270c232df92SToomas Soome.It Cm seek Ns = Ns Ar n
271c232df92SToomas Soome.Pp
272c232df92SToomas SoomeSkips
273c232df92SToomas Soome.Ar n
274c232df92SToomas Soomeblocks (using the specified output block size) from beginning of
275c232df92SToomas Soomeoutput file before copying.
276c232df92SToomas SoomeOn non-seekable files, existing blocks are read and space from the current
277c232df92SToomas Soomeend-of-file to the specified offset, if any, is filled with null bytes.
278c232df92SToomas SoomeOn seekable files, the implementation seeks to the specified
279c10c16deSRichard Loweoffset or reads the blocks as described for non-seekable files.
280c232df92SToomas Soome.It Cm ostride Ns = Ns Ar n
281c232df92SToomas Soome.Pp
282c232df92SToomas SoomeWrites every
283c232df92SToomas Soome.Ar n Ns
284c232df92SToomas Soometh block (using the specified output block size) when writing output.
285c232df92SToomas SoomeSkips
286c232df92SToomas Soome.Ar n
287c232df92SToomas Soome- 1 blocks after writing each record.
288c232df92SToomas Soome.It Cm istride Ns = Ns Ar n
289c232df92SToomas Soome.Pp
290c232df92SToomas SoomeReads every
291c232df92SToomas Soome.Ar n Ns
292c232df92SToomas Soometh block (using the specified input block size) when reading input.
293c232df92SToomas SoomeSkips
294c232df92SToomas Soome.Ar n
295c232df92SToomas Soome- 1 blocks after reading each record.
296c232df92SToomas Soome.It Cm stride Ns = Ns Ar n
297c232df92SToomas Soome.Pp
298c232df92SToomas SoomeReads every
299c232df92SToomas Soome.Ar n Ns
300c232df92SToomas Soometh block (using the specified input block size) when reading input.
301c232df92SToomas SoomeSkips
302c232df92SToomas Soome.Ar n
303c232df92SToomas Soome- 1 blocks after reading each record.
304c232df92SToomas SoomeAlso writes every
305c232df92SToomas Soome.Ar n Ns
306c232df92SToomas Soometh block (using the specified output block size) when writing output.
307c232df92SToomas SoomeSkips
308c232df92SToomas Soome.Ar n
309c232df92SToomas Soome- 1 blocks after writing each record.
310c232df92SToomas Soome.It Cm count Ns = Ns Ar n
311c232df92SToomas Soome.Pp
312c232df92SToomas SoomeCopies only
313c232df92SToomas Soome.Ar n
314c232df92SToomas Soomeinput blocks.
315c232df92SToomas Soome.It Cm conv Ns = Ns Ar value Ns Op , Ns  Ar value Ns ...
316c232df92SToomas Soome.Pp
317c232df92SToomas SoomeWhere
318c232df92SToomas Soome.Ar value Ns
319c232df92SToomas Soomes are comma-separated symbols from the following list:
320c232df92SToomas Soome.Bl -hang
321c232df92SToomas Soome.It Cm ascii
322c232df92SToomas SoomeConverts
323c232df92SToomas Soome.Cm EBCDIC
324c232df92SToomas Soometo
325c232df92SToomas Soome.Cm ASCII .
326c232df92SToomas Soome.sp
327c232df92SToomas Soome.It Cm asciib
328c232df92SToomas SoomeConverts
329c232df92SToomas Soome.Cm EBCDIC
330c232df92SToomas Soometo
331c232df92SToomas Soome.Cm ASCII
332c232df92SToomas Soomeusing
333c232df92SToomas Soome.Cm BSD Ns
334c232df92SToomas Soome-compatible character translations.
335c232df92SToomas Soome.It Cm ebcdic
336c232df92SToomas SoomeConverts
337c232df92SToomas Soome.Cm ASCII
338c232df92SToomas Soometo
339c232df92SToomas Soome.Cm EBCDIC .
340c232df92SToomas SoomeIf converting fixed-length
341c232df92SToomas Soome.Cm ASCII
342c232df92SToomas Soomerecords without
343c232df92SToomas Soome.Cm NEWLINE Ns
344c232df92SToomas Soomes, sets up a pipeline with
345c232df92SToomas Soome.Nm
346c232df92SToomas Soome.Cm conv Ns = Ns Ar unblock
347c10c16deSRichard Lowebeforehand.
348c232df92SToomas Soome.It Cm ebcdicb
349c232df92SToomas SoomeConverts
350c232df92SToomas Soome.Cm ASCII
351c232df92SToomas Soometo
352c232df92SToomas Soome.Cm EBCDIC
353c232df92SToomas Soomeusing
354c232df92SToomas Soome.Cm BSD Ns
355c232df92SToomas Soome-compatible character translations.
356c232df92SToomas SoomeIf converting fixed-length
357c232df92SToomas Soome.Cm ASCII
358c232df92SToomas Soomerecords without
359c232df92SToomas Soome.Cm NEWLINE Ns
360c232df92SToomas Soomes, sets up a pipeline with
361c232df92SToomas Soome.Nm
362c232df92SToomas Soome.Cm conv Ns = Ns Ar unblock
363c232df92SToomas Soomebeforehand.
364c232df92SToomas Soome.It Cm ibm
365c232df92SToomas SoomeSlightly different map of
366c232df92SToomas Soome.Cm ASCII
367c232df92SToomas Soometo
368c232df92SToomas Soome.Cm EBCDIC .
369c232df92SToomas SoomeIf converting fixed-length
370c232df92SToomas Soome.Cm ASCII
371c232df92SToomas Soomerecords without
372c232df92SToomas Soome.Cm NEWLINE Ns
373c232df92SToomas Soomes, sets up a pipeline with
374c232df92SToomas Soome.Nm
375c232df92SToomas Soome.Cm conv Ns = Ns Ar unblock
376c232df92SToomas Soomebeforehand.
377c232df92SToomas Soome.It Cm ibmb
378c232df92SToomas SoomeSlightly different map of
379c232df92SToomas Soome.Cm ASCII
380c232df92SToomas Soometo
381c232df92SToomas Soome.Cm EBCDIC
382c232df92SToomas Soomeusing
383c232df92SToomas Soome.Cm BSD Ns
384c232df92SToomas Soome-compatible character translations.
385c232df92SToomas SoomeIf converting fixed-length
386c232df92SToomas Soome.Cm ASCII
387c232df92SToomas Soomerecords without
388c232df92SToomas Soome.Cm NEWLINE Ns
389c232df92SToomas Soomes, sets up a pipeline with
390c232df92SToomas Soome.Nm
391c232df92SToomas Soome.Cm conv Ns = Ns Ar unblock
392c232df92SToomas Soomebeforehand.
393c232df92SToomas Soome.El
394c232df92SToomas Soome.Pp
395c232df92SToomas SoomeThe
396c232df92SToomas Soome.Cm ascii
397c232df92SToomas Soome(or
398c232df92SToomas Soome.Cm asciib Ns ),
399c232df92SToomas Soome.Cm ebcdic
400c232df92SToomas Soome(or
401c232df92SToomas Soome.Cm ebcdicb Ns ),
402c232df92SToomas Soomeand
403c232df92SToomas Soome.Cm ibm
404c232df92SToomas Soome(or
405c232df92SToomas Soome.Cm ibmb )
406c232df92SToomas Soomevalues are mutually exclusive.
407c232df92SToomas Soome.Bl -hang
408c232df92SToomas Soome.It Cm block
409c232df92SToomas SoomeTreats the input as a sequence of
410c232df92SToomas Soome.Cm NEWLINE Ns
411c232df92SToomas Soome-terminated or
412c232df92SToomas Soome.Cm EOF Ns
413c232df92SToomas Soome-terminated variable-length records independent of the input block boundaries.
414c232df92SToomas SoomeEach record is converted to a record with a fixed length specified
415c232df92SToomas Soomeby the conversion block size.
416c232df92SToomas SoomeAny
417c232df92SToomas Soome.Cm NEWLINE
418c232df92SToomas Soomecharacter is removed from the input line.
419c232df92SToomas Soome.Cm SPACE
420c232df92SToomas Soomecharacters are appended to lines that are shorter than their conversion block
421c232df92SToomas Soomesize to fill the block.
422c232df92SToomas SoomeLines that are longer than the conversion block size are truncated to the
423c232df92SToomas Soomelargest number of characters that will fit into that size.
424c232df92SToomas SoomeThe number of truncated lines is reported.
425c232df92SToomas Soome.It Cm unblock
426c232df92SToomas SoomeConverts fixed-length records to variable length.
427c232df92SToomas SoomeReads a number of bytes equal to the conversion block size (or the number of
428c232df92SToomas Soomebytes remaining in the input, if less than the conversion block size),
429c232df92SToomas Soomedelete all trailing
430c232df92SToomas Soome.Cm SPACE
431c232df92SToomas Soomecharacters, and append a
432c232df92SToomas Soome.Cm NEWLINE
433c232df92SToomas Soomecharacter.
434c232df92SToomas Soome.El
435c232df92SToomas Soome.Pp
436c232df92SToomas SoomeThe
437c232df92SToomas Soome.Cm block
438c232df92SToomas Soomeand
439c232df92SToomas Soome.Cm unblock
440c232df92SToomas Soomevalues are mutually exclusive.
441c232df92SToomas Soome.Bl -hang
442c232df92SToomas Soome.It Cm lcase
443c232df92SToomas SoomeMaps upper-case characters specified by the
444c232df92SToomas Soome.Cm LC_CTYPE
445c232df92SToomas Soomekeyword
446c232df92SToomas Soome.Cm tolower
447c232df92SToomas Soometo the corresponding lower-case character.
448c232df92SToomas SoomeCharacters for which no mapping is specified are not modified by this
449c232df92SToomas Soomeconversion.
450c232df92SToomas Soome.It Cm ucase
451c232df92SToomas SoomeMaps lower-case characters specified by the
452c232df92SToomas Soome.Cm LC_CTYPE
453c232df92SToomas Soomekeyword
454c232df92SToomas Soome.Cm toupper
455c232df92SToomas Soometo the corresponding upper-case character.
456c232df92SToomas SoomeCharacters for which no mapping is specified are not modified by this
457c232df92SToomas Soomeconversion.
458c232df92SToomas Soome.El
459c232df92SToomas Soome.Pp
460c232df92SToomas SoomeThe
461c232df92SToomas Soome.Cm lcase
462c232df92SToomas Soomeand
463c232df92SToomas Soome.Cm ucase
464c232df92SToomas Soomesymbols are mutually exclusive.
465c232df92SToomas Soome.Bl -hang
466c232df92SToomas Soome.It Cm swab
467c232df92SToomas SoomeSwaps every pair of input bytes.
468c232df92SToomas SoomeIf the current input record is an odd number of bytes, the last byte in the
469c232df92SToomas Soomeinput record is ignored.
470c232df92SToomas Soome.It Cm noerror
471c232df92SToomas SoomeDoes not stop processing on an input error.
472c232df92SToomas SoomeWhen an input error occurs, a diagnostic message is written on standard error,
473c232df92SToomas Soomefollowed by the current input and output block counts in the same format as
474c232df92SToomas Soomeused at completion.
475c232df92SToomas SoomeIf the
476c232df92SToomas Soome.Cm sync
477c232df92SToomas Soomeconversion is specified, the missing input is replaced with null
478c232df92SToomas Soomebytes and processed normally.
479c232df92SToomas SoomeOtherwise, the input block will be omitted from the output.
480c232df92SToomas Soome.It Cm notrunc
481c232df92SToomas SoomeDoes not truncate the output file.
482c232df92SToomas SoomePreserves blocks in the output file not explicitly written by this invocation
483c232df92SToomas Soomeof
484c232df92SToomas Soome.Nm .
485c232df92SToomas Soome(See also the preceding
486c232df92SToomas Soome.Cm of Ns = Ns Ar file
487c232df92SToomas Soomeoperand.)
488c232df92SToomas Soome.It Cm sync
489c232df92SToomas SoomePads every input block to the size of the
490c232df92SToomas Soome.Cm ibs Ns =
491c232df92SToomas Soomebuffer, appending null bytes.
492c232df92SToomas Soome(If either
493c232df92SToomas Soome.Cm block
494c232df92SToomas Soomeor
495c232df92SToomas Soome.Cm unblock
496c232df92SToomas Soomeis also specified, appends
497c232df92SToomas Soome.Cm SPACE
498c232df92SToomas Soomecharacters, rather than null bytes.)
499c232df92SToomas Soome.El
500c232df92SToomas Soome.It Cm iflag Ns = Ns Ar value Ns Op , Ns Ar value ...
501c232df92SToomas Soome.Pp
502c232df92SToomas SoomeWhere
503c232df92SToomas Soome.Ar value Ns
504c232df92SToomas Soomes are comma-separated symbols from the following list which
505c232df92SToomas Soomeaffect the behavior of reading from the input file:
506c232df92SToomas Soome.Bl -hang
507c232df92SToomas Soome.It Cm fullblock
508c232df92SToomas SoomeAccumulate full blocks of input.
509c232df92SToomas Soome.El
510c232df92SToomas Soome.It Cm oflag Ns = Ns Ar value Ns Op , Ns Ar value ...
51119d32b9aSRobert Mustacchi.ad
51219d32b9aSRobert Mustacchi.sp .6
513c232df92SToomas SoomeWhere
514c232df92SToomas Soome.Ar value Ns
515c232df92SToomas Soomes are comma-separated symbols from the following list which
51619d32b9aSRobert Mustacchiaffect the behavior of writing the output file:
517c232df92SToomas Soome.Bl -hang
518c232df92SToomas Soome.It Cm dsync
519c232df92SToomas SoomeThe output file is opened with the
520c232df92SToomas Soome.Cm O_DSYNC
521c232df92SToomas Soomeflag set.
522c232df92SToomas SoomeAll data writes will be synchronous.
523c232df92SToomas SoomeFor more information on
524c232df92SToomas Soome.Cm O_DSYNC
525c232df92SToomas Soomesee
526c232df92SToomas Soome.Xr fcntl.h 3HEAD .
527c232df92SToomas Soome.It Cm sync
528c232df92SToomas SoomeThe output file is opened with the
529c232df92SToomas Soome.Cm O_SYNC .
530c232df92SToomas SoomeAll data and metadata writes will be synchronous.
531c232df92SToomas SoomeFor more information on
532c232df92SToomas Soome.Cm O_SYNC
533c232df92SToomas Soomesee
534c232df92SToomas Soome.Xr fcntl.h 3HEAD .
535c232df92SToomas Soome.El
536c53c97f7SRobert Mustacchi.It Cm status Ns = Ns Ar type
537c53c97f7SRobert MustacchiChanges the way that
538c53c97f7SRobert Mustacchi.Nm
539c53c97f7SRobert Mustacchioutputs information about transfers.
540c53c97f7SRobert MustacchiOnly one
541c53c97f7SRobert Mustacchi.Ar type may be specified.
542c53c97f7SRobert MustacchiThe following are valid values for
543c53c97f7SRobert Mustacchi.Ar type :
544c53c97f7SRobert Mustacchi.Bl -hang
545c53c97f7SRobert Mustacchi.It Cm none
546c53c97f7SRobert MustacchiThe program will not output any information and statistics about the transfer.
547c53c97f7SRobert MustacchiThis includes when
548c53c97f7SRobert Mustacchi.Nm
549c53c97f7SRobert Mustacchireceives a signal such as
550c53c97f7SRobert Mustacchi.Dv SIGINFO
551c53c97f7SRobert Mustacchiand
552c53c97f7SRobert Mustacchi.Dv SIGUSR1 .
553c53c97f7SRobert MustacchiOnly errors will be emitted.
554c53c97f7SRobert Mustacchi.It Cm noxfer
555c53c97f7SRobert MustacchiWhen printing statistical information such as when the program terminates or in
556c53c97f7SRobert Mustacchiresponse to a signal, only print information about the number of records and
557c53c97f7SRobert Mustacchinone of the statistics about the transfer
558c53c97f7SRobert Mustacchi.Pq total bytes, total time, and throughput .
559c53c97f7SRobert Mustacchi.It Cm progress
560c53c97f7SRobert MustacchiOnce a second, output the normal
561c53c97f7SRobert Mustacchi.Nm
562c53c97f7SRobert Mustacchitransfer statistics that include the total number of bytes transferred, time
563c53c97f7SRobert Mustacchielapsed, and average throughput.
564c53c97f7SRobert Mustacchi.El
565c232df92SToomas Soome.El
566c232df92SToomas Soome.Pp
567c232df92SToomas SoomeIf operands other than
568c232df92SToomas Soome.Cm conv Ns =
569c232df92SToomas Soomeand
570c232df92SToomas Soome.Cm oflag Ns =
571c232df92SToomas Soomeare specified more than once, the last specified
572c232df92SToomas Soome.Cm operand Ns = Ns Ar value
573c232df92SToomas Soomeis used.
574c232df92SToomas Soome.Pp
575c232df92SToomas SoomeFor the
576c232df92SToomas Soome.Cm bs Ns = ,
577c232df92SToomas Soome.Cm cbs Ns = ,
578c232df92SToomas Soome.Cm ibs Ns = ,
579c232df92SToomas Soomeand
580c232df92SToomas Soome.Cm obs Ns =
581c232df92SToomas Soomeoperands, the application must supply an expression specifying a size in bytes.
582c232df92SToomas SoomeThe expression,
583c232df92SToomas Soome.Cm expr ,
584c232df92SToomas Soomecan be:
585c232df92SToomas Soome.Bl -enum -offset indent -compact
586c232df92SToomas Soome.It
587c10c16deSRichard Lowea positive decimal number
588c232df92SToomas Soome.Pp
589c232df92SToomas Soome.It
590c232df92SToomas Soomea positive decimal number followed by
591c232df92SToomas Soome.Sy k ,
592c232df92SToomas Soomespecifying multiplication by 1024
593c232df92SToomas Soome.Pp
594c232df92SToomas Soome.It
595c232df92SToomas Soomea positive decimal number followed by
596c232df92SToomas Soome.Sy M ,
597c232df92SToomas Soomespecifying multiplication by 1024*1024
598c232df92SToomas Soome.Pp
599c232df92SToomas Soome.It
600c232df92SToomas Soomea positive decimal number followed by
601c232df92SToomas Soome.Sy G ,
602c232df92SToomas Soomespecifying multiplication by 1024*1024*1024
603c232df92SToomas Soome.Pp
604c232df92SToomas Soome.It
605c232df92SToomas Soomea positive decimal number followed by
606c232df92SToomas Soome.Sy T ,
607c232df92SToomas Soomespecifying multiplication by 1024*1024*1024*1024
608c232df92SToomas Soome.Pp
609c232df92SToomas Soome.It
610c232df92SToomas Soomea positive decimal number followed by
611c232df92SToomas Soome.Sy P ,
612c232df92SToomas Soomespecifying multiplication by 1024*1024*1024*1024*1024
613c232df92SToomas Soome.Pp
614c232df92SToomas Soome.It
615c232df92SToomas Soomea positive decimal number followed by
616c232df92SToomas Soome.Sy E ,
617c232df92SToomas Soomespecifying multiplication by 1024*1024*1024*1024*1024*1024
618c232df92SToomas Soome.Pp
619c232df92SToomas Soome.It
620c232df92SToomas Soomea positive decimal number followed by
621c232df92SToomas Soome.Sy Z ,
622c232df92SToomas Soomespecifying multiplication by 1024*1024*1024*1024*1024*1024*1024
623c232df92SToomas Soome.Pp
624c232df92SToomas Soome.It
625c232df92SToomas Soomea positive decimal number followed by
626c232df92SToomas Soome.Sy b ,
627c232df92SToomas Soomespecifying multiplication by 512
628c232df92SToomas Soome.Pp
629c232df92SToomas Soome.It
630c232df92SToomas Soometwo or more positive decimal numbers (with or without
631c232df92SToomas Soome.Sy k
632c232df92SToomas Soomeor
633c232df92SToomas Soome.Sy b )
634c232df92SToomas Soomeseparated by
635c232df92SToomas Soome.Sy x ,
636c232df92SToomas Soomespecifying the product of the indicated values.
637c232df92SToomas Soome.El
638c232df92SToomas Soome.Pp
639c10c16deSRichard LoweAll of the operands will be processed before any input is read.
640c232df92SToomas Soome.Sh SIGNALS
641c232df92SToomas SoomeWhen
642c232df92SToomas Soome.Nm
643c232df92SToomas Soomereceives either SIGINFO or SIGUSR1,
644c232df92SToomas Soome.Nm
645c232df92SToomas Soomewill emit the current input and output block counts, total bytes written,
646c232df92SToomas Soometotal time elapsed, and the number of bytes per second to standard error.
647c232df92SToomas SoomeThis is the same information format that
648c232df92SToomas Soome.Nm
649c232df92SToomas Soomeemits when it successfully completes.
650c232df92SToomas SoomeUsers may send SIGINFO via their terminal.
651c232df92SToomas SoomeThe default character is ^T, see
652c232df92SToomas Soome.Xr stty 1
653c232df92SToomas Soomefor more information.
654c232df92SToomas Soome.Pp
655c232df92SToomas SoomeFor
656c232df92SToomas Soome.Sy SIGINT ,
657c232df92SToomas Soome.Nm
658c232df92SToomas Soomewrites status information to standard error before exiting.
659c232df92SToomas Soome.Nm
660c232df92SToomas Soometakes the standard action for all other signals.
661c232df92SToomas Soome.Sh USAGE
662c232df92SToomas SoomeSee
663*bbf21555SRichard Lowe.Xr largefile 7
664c232df92SToomas Soomefor the description of the behavior of
665c232df92SToomas Soome.Nm
666c232df92SToomas Soomewhen encountering files greater than or equal to 2 Gbyte (2^31 bytes).
667c232df92SToomas Soome.Sh EXIT STATUS
668c10c16deSRichard LoweThe following exit values are returned:
669c232df92SToomas Soome.Bl -tag -width ".It Cm >0"
670c232df92SToomas Soome.It Cm 0
671c10c16deSRichard LoweThe input file was copied successfully.
672c232df92SToomas Soome.It Cm >0
673c10c16deSRichard LoweAn error occurred.
674c232df92SToomas Soome.El
675c232df92SToomas Soome.Pp
676c232df92SToomas SoomeIf an input error is detected and the
677c232df92SToomas Soome.Cm noerror
678c232df92SToomas Soomeconversion has not been specified, any partial output block will be written
679c232df92SToomas Soometo the output file, a diagnostic message will be written, and the copy
680c232df92SToomas Soomeoperation will be discontinued.
681c232df92SToomas SoomeIf some other error is detected, a diagnostic message will be
682c10c16deSRichard Lowewritten and the copy operation will be discontinued.
683c232df92SToomas Soome.Sh EXAMPLES
684c232df92SToomas Soome.Bl -ohang
685c232df92SToomas Soome.It Sy Example 1 No Copying from one tape drive to another
686c232df92SToomas Soome.Pp
687c232df92SToomas SoomeThe following example copies from tape drive
688c232df92SToomas Soome.Sy 0
689c232df92SToomas Soometo tape drive
690c232df92SToomas Soome.Sy 1 ,
691c232df92SToomas Soomeusing a common historical device naming convention.
692c232df92SToomas Soome.Pp
693c232df92SToomas Soome.Dl % dd if=/dev/rmt/0h of=/dev/rmt/1h
694c232df92SToomas Soome.It Sy Example 2 No Stripping the first 10 bytes from standard input
695c232df92SToomas Soome.Pp
696c232df92SToomas SoomeThe following example strips the first 10 bytes from standard input:
697c232df92SToomas Soome.Pp
698c232df92SToomas Soome.Dl % dd ibs=10  skip=1
699c232df92SToomas Soome.It Sy Example 3 No Reading a tape into an ASCII file
700c232df92SToomas Soome.Pp
701c232df92SToomas SoomeThis example reads an
702c232df92SToomas Soome.Cm EBCDIC
703c232df92SToomas Soometape blocked ten 80-byte
704c232df92SToomas Soome.Cm EBCDIC
705c232df92SToomas Soomecard images per block into the
706c232df92SToomas Soome.Cm ASCII
707c232df92SToomas Soomefile
708c232df92SToomas Soome.Sy x :
709c232df92SToomas Soome.Pp
710c232df92SToomas Soome.Dl % dd if=/dev/tape of=x ibs=800 cbs=80 conv=ascii,lcase
711c232df92SToomas Soome.It Sy Example 4 No Using conv=sync to write to tape
712c232df92SToomas Soome.Pp
713c232df92SToomas SoomeThe following example uses
714c232df92SToomas Soome.Cm conv Ns = Ns Ar sync
715c232df92SToomas Soomewhen writing to a tape:
716c232df92SToomas Soome.Pp
717c232df92SToomas Soome.Dl % tar cvf - . | compress | dd obs=1024k of=/dev/rmt/0 conv=sync
718c232df92SToomas Soome.El
719c232df92SToomas Soome.Sh DIAGNOSTICS
720c232df92SToomas Soome.Bl -hang
721c232df92SToomas Soome.It Sy f+p records in(out)
722c10c16deSRichard Lowenumbers of full and partial blocks read(written)
723c232df92SToomas Soome.El
724c232df92SToomas Soome.Sh ENVIRONMENT VARIABLES
725c232df92SToomas SoomeSee
726*bbf21555SRichard Lowe.Xr environ 7
727c232df92SToomas Soomefor descriptions of the following environment variables
728c232df92SToomas Soomethat affect the execution of
729c232df92SToomas Soome.Nm :
730c232df92SToomas Soome.Ev LANG ,
731c232df92SToomas Soome.Ev LC_ALL ,
732c232df92SToomas Soome.Ev LC_CTYPE ,
733c232df92SToomas Soome.Ev LC_MESSAGES ,
734c232df92SToomas Soomeand
735c232df92SToomas Soome.Ev NLSPATH .
736c232df92SToomas Soome.Sh INTERFACE STABILITY
737c232df92SToomas SoomeStandard
738c232df92SToomas Soome.Sh SEE ALSO
739c232df92SToomas Soome.Xr cp 1 ,
740c232df92SToomas Soome.Xr sed 1 ,
741c232df92SToomas Soome.Xr tr 1 ,
742c232df92SToomas Soome.Xr fcntl.h 3HEAD ,
743*bbf21555SRichard Lowe.Xr attributes 7 ,
744*bbf21555SRichard Lowe.Xr environ 7 ,
745*bbf21555SRichard Lowe.Xr largefile 7 ,
746*bbf21555SRichard Lowe.Xr standards 7
747c232df92SToomas Soome.Sh NOTES
748c232df92SToomas SoomeDo not use
749c232df92SToomas Soome.Nm
750c232df92SToomas Soometo copy files between file systems having different block sizes.
751c232df92SToomas Soome.Pp
752c10c16deSRichard LoweUsing a  blocked device to copy a file will result in extra nulls being added
753c10c16deSRichard Loweto the file to pad the final block to the block boundary.
754c232df92SToomas Soome.Pp
755c232df92SToomas SoomeWhen
756c232df92SToomas Soome.Nm
757c232df92SToomas Soomereads from a pipe, using the
758c232df92SToomas Soome.Cm ibs Ns = Ns Ar X
759c232df92SToomas Soomeand
760c232df92SToomas Soome.Cm obs Ns = Ns Ar Y
761c232df92SToomas Soomeoperands, the output will always be blocked in chunks of size Y.
762c232df92SToomas SoomeWhen
763c232df92SToomas Soome.Cm bs Ns = Ns Ar Z
764c232df92SToomas Soomeis used, the output blocks will be whatever was available to be read
765c10c16deSRichard Lowefrom the pipe at the time.
766c232df92SToomas Soome.Pp
767c232df92SToomas SoomeWhen using
768c232df92SToomas Soome.Nm
769c232df92SToomas Soometo copy files to a tape device, the file size must be a multiple of the
770c232df92SToomas Soomedevice sector size (for example, 512 Kbyte).
771c232df92SToomas SoomeTo copy files of arbitrary size to a tape device, use
772c232df92SToomas Soome.Xr tar 1
773c232df92SToomas Soomeor
774c232df92SToomas Soome.Xr cpio 1 .
775