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