dd 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. .HP
  86. \fL-conv\ ascii\ \ \ \ \fRConvert
  87. .SM EBCDIC
  88. to
  89. .SM ASCII.
  90. .PD0
  91. .RS "\w'\fLconv\ \fP'u"
  92. .TP "\w'\fLunblock\ \ \fP'u"
  93. .B ebcdic
  94. Convert
  95. .SM ASCII
  96. to
  97. .SM EBCDIC.
  98. .TP
  99. .B ibm
  100. Like
  101. .B ebcdic
  102. but with a slightly different character map.
  103. .TP
  104. .B block
  105. Convert variable length
  106. .SM ASCII
  107. records to fixed length.
  108. .TP
  109. .B unblock
  110. Convert fixed length
  111. .SM ASCII
  112. records to variable length.
  113. .TP
  114. .B lcase
  115. Map alphabetics to lower case.
  116. .TP
  117. .B ucase
  118. Map alphabetics to upper case.
  119. .TP
  120. .B swab
  121. Swap every pair of bytes.
  122. .TP
  123. .B noerror
  124. Do not stop processing on an error.
  125. .TP
  126. .B sync
  127. Pad every input record to
  128. .I ibs\^
  129. bytes.
  130. .RE
  131. .PD
  132. .PP
  133. .fi
  134. Where sizes are specified,
  135. a number of bytes is expected.
  136. A number may end with
  137. .L k
  138. or
  139. .LR b
  140. to specify multiplication by
  141. 1024 or 512 respectively;
  142. a pair of numbers may be separated by
  143. .L x
  144. to indicate a product.
  145. Multiple conversions may be specified in the style:
  146. .LR "-conv ebcdic,ucase" .
  147. .PP
  148. .L Cbs\^
  149. is used only if
  150. .LR ascii\^ ,
  151. .LR unblock\^ ,
  152. .LR ebcdic\^ ,
  153. .LR ibm\^ ,
  154. or
  155. .L block\^
  156. conversion is specified.
  157. In the first two cases,
  158. .I n
  159. characters are copied into the conversion buffer, any specified
  160. character mapping is done,
  161. trailing blanks are trimmed and new-line is added
  162. before sending the line to the output.
  163. In the latter three cases, characters are read into the
  164. conversion buffer and blanks are added to make up an
  165. output record of size
  166. .IR n .
  167. If
  168. .L cbs\^
  169. is unspecified or zero, the
  170. .LR ascii\^ ,
  171. .LR ebcdic\^ ,
  172. and
  173. .L ibm\^
  174. options convert the character set without changing the block
  175. structure of the input file; the
  176. .L unblock\^
  177. and
  178. .L block\^
  179. options become a simple file copy.
  180. .SH SOURCE
  181. .B /sys/src/cmd/dd.c
  182. .SH "SEE ALSO"
  183. .IR cp (1)
  184. .SH DIAGNOSTICS
  185. .I Dd
  186. reports the number of full + partial input and output
  187. blocks handled.