dd 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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 "quiet\ \ \fIn
  20. .PD
  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 records before copying.
  58. .TP
  59. .BI -iseek\ n\^
  60. Seek
  61. .I n
  62. records forward on input file
  63. before copying.
  64. .TP
  65. .BI -files\ n\^
  66. Catenate
  67. .I n
  68. input files (useful only for magnetic tape or similar input device).
  69. .TP
  70. .BI -oseek\ n\^
  71. Seek
  72. .I n\^
  73. records from beginning of output file before copying.
  74. .TP
  75. .BI -count\ n\^
  76. Copy only
  77. .I n
  78. input records.
  79. .TP
  80. .BI -trunc\ n\^
  81. By default,
  82. .I dd
  83. truncates the output file when it opens it;
  84. .B -trunc
  85. .B 0
  86. opens it without truncation.
  87. .TP
  88. .BI -quiet\ n\^
  89. By default,
  90. .I dd
  91. prints the number of blocks read and written
  92. once it is finished.
  93. .B -quiet
  94. .B 1
  95. silences this summary.
  96. .HP
  97. \fL-conv\ ascii\ \ \ \ \fRConvert
  98. .SM EBCDIC
  99. to
  100. .SM ASCII.
  101. .PD0
  102. .RS "\w'\fLconv\ \fP'u"
  103. .TP "\w'\fLunblock\ \ \fP'u"
  104. .B ebcdic
  105. Convert
  106. .SM ASCII
  107. to
  108. .SM EBCDIC.
  109. .TP
  110. .B ibm
  111. Like
  112. .B ebcdic
  113. but with a slightly different character map.
  114. .TP
  115. .B block
  116. Convert variable length
  117. .SM ASCII
  118. records to fixed length.
  119. .TP
  120. .B unblock
  121. Convert fixed length
  122. .SM ASCII
  123. records to variable length.
  124. .TP
  125. .B lcase
  126. Map alphabetics to lower case.
  127. .TP
  128. .B ucase
  129. Map alphabetics to upper case.
  130. .TP
  131. .B swab
  132. Swap every pair of bytes.
  133. .TP
  134. .B noerror
  135. Do not stop processing on an error.
  136. .TP
  137. .B sync
  138. Pad every input record to
  139. .I ibs\^
  140. bytes.
  141. .RE
  142. .PD
  143. .PP
  144. .fi
  145. Where sizes are specified,
  146. a number of bytes is expected.
  147. A number may end with
  148. .L k
  149. or
  150. .LR b
  151. to specify multiplication by
  152. 1024 or 512 respectively;
  153. a pair of numbers may be separated by
  154. .L x
  155. to indicate a product.
  156. Multiple conversions may be specified in the style:
  157. .LR "-conv ebcdic,ucase" .
  158. .PP
  159. .L Cbs\^
  160. is used only if
  161. .LR ascii\^ ,
  162. .LR unblock\^ ,
  163. .LR ebcdic\^ ,
  164. .LR ibm\^ ,
  165. or
  166. .L block\^
  167. conversion is specified.
  168. In the first two cases,
  169. .I n
  170. characters are copied into the conversion buffer, any specified
  171. character mapping is done,
  172. trailing blanks are trimmed and new-line is added
  173. before sending the line to the output.
  174. In the latter three cases, characters are read into the
  175. conversion buffer and blanks are added to make up an
  176. output record of size
  177. .IR n .
  178. If
  179. .L cbs\^
  180. is unspecified or zero, the
  181. .LR ascii\^ ,
  182. .LR ebcdic\^ ,
  183. and
  184. .L ibm\^
  185. options convert the character set without changing the block
  186. structure of the input file; the
  187. .L unblock\^
  188. and
  189. .L block\^
  190. options become a simple file copy.
  191. .SH SOURCE
  192. .B /sys/src/cmd/dd.c
  193. .SH "SEE ALSO"
  194. .IR cp (1)
  195. .SH DIAGNOSTICS
  196. .I Dd
  197. reports the number of full + partial input and output
  198. blocks handled.