dd 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. .TH DD 1
  2. .SH NAME
  3. dd \- convert and copy a file
  4. .SH SYNOPSIS
  5. .B dd
  6. [
  7. .I option value
  8. ]
  9. \&...
  10. .SH DESCRIPTION
  11. .I Dd\^
  12. copies the specified input file
  13. to the specified output with
  14. possible conversions.
  15. The standard input and output are used by default.
  16. The input and output block size may be
  17. specified to take advantage of raw physical I/O.
  18. The options are
  19. .TP \w'\fLoseek\ \ \fIn'u
  20. .BI -if\ f
  21. Open file
  22. .I f
  23. for input.
  24. .TP
  25. .BI -of\ f
  26. Open file
  27. .I f
  28. for output.
  29. .TP
  30. .BI -ibs\ n\^
  31. Set input block size to
  32. .I n\^
  33. bytes (default 512).
  34. .TP
  35. .BI -obs\ n\^
  36. Set output block size (default 512).
  37. .TP
  38. .BI -bs\ n\^
  39. Set both input and output block size,
  40. superseding
  41. .I ibs\^
  42. and
  43. .IR obs .
  44. If no conversion is specified,
  45. preserve the input block size instead of packing short blocks
  46. into the output buffer.
  47. This is particularly efficient since no in-core copy need be done.
  48. .TP
  49. .BI -cbs\ n\^
  50. Set conversion buffer size.
  51. .TP
  52. .BI -skip\ n\^
  53. Skip
  54. .I n
  55. input records before copying.
  56. .TP
  57. .BI -iseek\ n\^
  58. Seek
  59. .I n
  60. records forward on input file
  61. before copying.
  62. .TP
  63. .BI -files\ n\^
  64. Catenate
  65. .I n
  66. input files (useful only for magnetic tape or similar input device).
  67. .TP
  68. .BI -oseek\ n\^
  69. Seek
  70. .I n\^
  71. records from beginning of output file before copying.
  72. .TP
  73. .BI -count\ n\^
  74. Copy only
  75. .I n
  76. input records.
  77. .TP
  78. .BI -trunc\ n\^
  79. By default,
  80. .I dd
  81. truncates the output file when it opens it;
  82. .B -trunc
  83. .B 0
  84. opens it without truncation.
  85. .TP
  86. .BI -quiet\ n\^
  87. By default,
  88. .I dd
  89. prints the number of blocks read and written
  90. once it is finished.
  91. .B -quiet
  92. .B 1
  93. silences this summary.
  94. .HP
  95. \fL-conv\ ascii\ \ \ \ \fRConvert
  96. .SM EBCDIC
  97. to
  98. .SM ASCII.
  99. .PD0
  100. .RS "\w'\fLconv\ \fP'u"
  101. .TP "\w'\fLunblock\ \ \fP'u"
  102. .B ebcdic
  103. Convert
  104. .SM ASCII
  105. to
  106. .SM EBCDIC.
  107. .TP
  108. .B ibm
  109. Like
  110. .B ebcdic
  111. but with a slightly different character map.
  112. .TP
  113. .B block
  114. Convert variable length
  115. .SM ASCII
  116. records to fixed length.
  117. .TP
  118. .B unblock
  119. Convert fixed length
  120. .SM ASCII
  121. records to variable length.
  122. .TP
  123. .B lcase
  124. Map alphabetics to lower case.
  125. .TP
  126. .B ucase
  127. Map alphabetics to upper case.
  128. .TP
  129. .B swab
  130. Swap every pair of bytes.
  131. .TP
  132. .B noerror
  133. Do not stop processing on an error.
  134. .TP
  135. .B sync
  136. Pad every input record to
  137. .I ibs\^
  138. bytes.
  139. .RE
  140. .PD
  141. .PP
  142. .fi
  143. Where sizes are specified,
  144. a number of bytes is expected.
  145. A number may end with
  146. .L k
  147. or
  148. .LR b
  149. to specify multiplication by
  150. 1024 or 512 respectively;
  151. a pair of numbers may be separated by
  152. .L x
  153. to indicate a product.
  154. Multiple conversions may be specified in the style:
  155. .LR "-conv ebcdic,ucase" .
  156. .PP
  157. .L Cbs\^
  158. is used only if
  159. .LR ascii\^ ,
  160. .LR unblock\^ ,
  161. .LR ebcdic\^ ,
  162. .LR ibm\^ ,
  163. or
  164. .L block\^
  165. conversion is specified.
  166. In the first two cases,
  167. .I n
  168. characters are copied into the conversion buffer, any specified
  169. character mapping is done,
  170. trailing blanks are trimmed and new-line is added
  171. before sending the line to the output.
  172. In the latter three cases, characters are read into the
  173. conversion buffer and blanks are added to make up an
  174. output record of size
  175. .IR n .
  176. If
  177. .L cbs\^
  178. is unspecified or zero, the
  179. .LR ascii\^ ,
  180. .LR ebcdic\^ ,
  181. and
  182. .L ibm\^
  183. options convert the character set without changing the block
  184. structure of the input file; the
  185. .L unblock\^
  186. and
  187. .L block\^
  188. options become a simple file copy.
  189. .SH SOURCE
  190. .B /sys/src/cmd/dd.c
  191. .SH "SEE ALSO"
  192. .IR cp (1)
  193. .SH DIAGNOSTICS
  194. .I Dd
  195. reports the number of full + partial input and output
  196. blocks handled.