xref: /original-bsd/bin/dd/dd.1 (revision 08eb28af)
1.\" Copyright (c) 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.roff%
5.\"
6.\"     @(#)dd.1	6.4 (Berkeley) 04/24/91
7.\"
8.Dd
9.Dt DD 1
10.Os
11.Sh NAME
12.Nm dd
13.Nd convert and copy a file
14.Sh SYNOPSIS
15.Nm dd
16.Op options ...
17.Sh DESCRIPTION
18The
19.Nm
20utility copies the specified input file to the specified
21output with possible conversions.
22.Pp
23The following options are available:
24.Bl -tag -width of=file
25.It Cm if= Ns Ar file
26Input pathname; standard input is
27default.
28.It Cm of= Ns Ar file
29Output pathname; standard output is
30default.
31.It Cm ibs= Ns Ar n
32Input block size
33.Va n
34bytes (default is
35512 bytes).
36.It Cm obs= Ns Ar n
37Output block size (default is 512 bytes).
38.It Cm bs= Ns Ar n
39Set both input and output block size,
40superseding
41.Cm ibs
42and
43.Cm obs .
44.It Cm cbs= Ns Ar n
45Conversion buffer size
46.It Cm skip= Ns Ar n
47Skip
48.Va n
49input blocks (each block is the
50size of
51.Cm ibs )
52before starting copy.
53.It Cm seek= Ns Ar n
54Seek
55.Ar n
56blocks (each block is the size of
57obs) from beginning of output file before
58copying.
59.It Cm count= Ns Ar n
60Copy only
61.Va n
62input blocks.
63.It Xo
64.Cm conv=
65.Ns Ar value Ns Op \&, Ar value \&...
66.Xc
67Where values are comma-separated symbols
68from the following list.
69.Bl -tag -width unblock
70.It Ar block
71Convert variable length records to fixed
72length.
73Read characters into the
74.Ar cbs
75buffer, delete a trailing <newline>, and
76pad to the length of the
77.Ar cbs
78buffer with
79<space>s.
80Both
81.Ar block
82and
83.Ar unblock
84are mutually
85exclusive.
86.It Ar unblock
87Convert fixed length records to variable
88length.
89Read a number of characters
90equal to the size of the
91.Ar cbs
92buffer,
93delete all trailing <blank>s, and append
94a <newline>.
95.It Ar lcase
96Map characters in the alpha character
97classification from class upper to the
98corresponding value in class lower.
99Both
100.Ar lcase
101and
102.Ar ucase
103are mutually exclusive.
104.It Ar ucase
105Map characters in the alpha character
106classification from class lower to the
107corresponding value in class upper.
108.It Ar swab
109Swap every pair of bytes
110.It Ar noerror
111Do not stop processing on an error.
112.It Ar sync
113Pad every input block to the size of
114.Ar ibs
115buffer, appending <space> characters.
116.El
117.El
118.Pp
119Where sizes are specified, a decimal number of bytes is
120expected.
121A size can end with
122.Cm k
123or
124.Cm b
125to specify multiplication
126by 1024 or 512, respectively.
127A pair of sizes can be
128separated by
129.Cm x
130to indicate a product.
131.Pp
132If the option
133.Cm if=
134is not specified, the standard input is used.
135.Pp
136The input files can be any file type and
137on completion,
138.Nm
139writes the number of input and output
140blocks, full and partial counts, to the standard error.
141.Pp
142A partial block may be caused by a read or write operation
143transferring less than
144.Cm ibs
145bytes.
146Only bytes read
147have conversions, as specified by the options, applied to
148them.
149.Pp
150For
151.Dv SIGINT ,
152the
153.Nm
154utility writes status information to
155standard error before exiting.
156It takes the default action
157for all other signals.
158.Pp
159The
160.Nm
161utility exits 0 on success, and >0 if an error occurs.
162.Pp
163If an error is detected, and the noerror option has not
164been supplied, the cause is reported and the
165.Nm
166utility
167aborts the copy of the file.
168.Sh SEE ALSO
169.Xr tr 1
170.Sh STANDARDS
171The
172.Nm
173utility is expected to be
174.St -p1003.2
175compatible.
176