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