dd 3.3 KB

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